Skip to content

Commit c68fb3b

Browse files
author
0668001533
committed
fix(cli): improve error message for unknown requestId in devices approve
- Add helpful context when approvePairingWithFallback returns null - Show pending request IDs to guide user - Suggest running 'openclaw devices list' for more info
1 parent 12712cc commit c68fb3b

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

‎src/cli/devices-cli.runtime.ts‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,22 @@ export async function runDevicesApproveCommand(
925925
}
926926
const result = await approvePairingWithFallback(opts, resolvedRequestId);
927927
if (!result) {
928-
defaultRuntime.error("unknown requestId");
928+
// 提供更友好的错误提示,帮助用户理解为什么找不到 requestId
929+
try {
930+
const list = await listPairingWithFallback(opts);
931+
const pendingIds = list.pending?.map(p => p.requestId) || [];
932+
const pairedIds = list.paired?.map(p => p.deviceId) || [];
933+
defaultRuntime.error(`Request ID '${resolvedRequestId}' not found.`);
934+
if (pendingIds.length === 0 && pairedIds.length === 0) {
935+
defaultRuntime.error('No pending or paired devices found.');
936+
} else if (pendingIds.length === 0) {
937+
defaultRuntime.error('Only paired devices exist. Use "openclaw devices list" to see available devices.');
938+
} else {
939+
defaultRuntime.error('Pending requests: ' + pendingIds.join(', '));
940+
}
941+
} catch {
942+
defaultRuntime.error("unknown requestId");
943+
}
929944
defaultRuntime.exit(1);
930945
return;
931946
}

0 commit comments

Comments
 (0)