jackwener/OpenCLI · error · TimeoutError
Current status=${latestActivity?.Status ?? ''}, approvalPend
Error message
Current status=${latestActivity?.Status ?? ''}, approvalPending=${latestActivity?.ApprovalPending ?? ''}, approvalKind=${latestActivity?.ApprovalKind ?? ''}, approvalButton=${latestActivity?.ApprovalButton ?? ''}. Use "opencli trae-cn targets -f json" to find the waiting target, then run "OPENCLI_CDP_TARGET=<target> opencli trae-cn watch --stream true --duration 300" or "opencli trae-cn approve". What it means
ask.js throws a TimeoutError when the Trae CN activity stream is still showing a blocking activity (an approval prompt or waiting state) when the timeout elapses. The message embeds the latest activity's Status/ApprovalPending/ApprovalKind/ApprovalButton fields and tells the operator how to find and approve the waiting target via CDP. It exists so an agent stuck on a permission dialog is distinguishable from one still generating.
Source
Thrown at clis/trae-cn/ask.js:89
lastText = text;
stableSince = Date.now();
continue;
}
const stableFor = Date.now() - stableSince;
const blocked = isLikelyBlockingActivity(latestActivity);
const completed = isActivityComplete(latestActivity);
if (completed && !blocked && stableFor >= 1000) {
return [latest];
}
if (!blocked && stableFor >= 3000) {
return [latest];
}
}
if (latest?.Text) {
const blocked = isLikelyBlockingActivity(latestActivity);
if (blocked) {
throw new TimeoutError(
'trae-cn ask',
timeout,
`Current status=${latestActivity?.Status ?? ''}, approvalPending=${latestActivity?.ApprovalPending ?? ''}, approvalKind=${latestActivity?.ApprovalKind ?? ''}, approvalButton=${latestActivity?.ApprovalButton ?? ''}. Use "opencli trae-cn targets -f json" to find the waiting target, then run "OPENCLI_CDP_TARGET=<target> opencli trae-cn watch --stream true --duration 300" or "opencli trae-cn approve".`,
);
}
return [latest];
}
throw new TimeoutError('trae-cn ask', timeout, 'No Trae CN response was visible before the timeout. The agent may still be generating.');
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Run `opencli trae-cn targets -f json` to find the waiting target, then `OPENCLI_CDP_TARGET=<target> opencli trae-cn approve` to accept the pending prompt.
- Alternatively attach with `OPENCLI_CDP_TARGET=<target> opencli trae-cn watch --stream true --duration 300` to observe and interact.
- Re-run ask with a larger --timeout if the approval just needs more time.
- Ensure no stale approval dialogs are open before issuing ask.
Example fix
// before opencli trae-cn ask "do the task" --timeout 30 // after opencli trae-cn targets -f json # find waiting target OPENCLI_CDP_TARGET=<target> opencli trae-cn approve opencli trae-cn ask "do the task" --timeout 120
Defensive patterns
Strategy: try-catch
Validate before calling
// Before running ask, check for an already-waiting target
const { execSync } = require('child_process');
const targets = JSON.parse(execSync('opencli trae-cn targets -f json', 'utf8'));
const waiting = targets.filter(t => t.activity && /approve|pending|waiting/i.test(JSON.stringify(t.activity)));
if (waiting.length) console.warn('Resolve pending approval first:', waiting.map(t => t.target)); Type guard
function isBlockingActivity(a) {
return Boolean(a && typeof a === 'object' &&
(a.ApprovalPending === true || a.ApprovalButton || /wait|approve/i.test(String(a.Status ?? ''))));
} Try / catch
try {
await runAsk(timeout);
} catch (e) {
if (e instanceof TimeoutError && /approvalPending=true/i.test(e.message)) {
const target = findWaitingTarget(); // opencli trae-cn targets -f json
execSync(`OPENCLI_CDP_TARGET=${target} opencli trae-cn approve`);
return runAsk(timeout); // retry once after approving
}
throw e;
} Prevention
- Clear any pending approval dialogs before launching ask.
- Use a generous --timeout when running unattended.
- Monitor with `opencli trae-cn watch --stream true` to spot approvals early.
- Automate approve via targets -f json polling.
When it happens
Trigger: Calling `opencli trae-cn ask` when the Trae CN agent has raised an approval prompt (isLikelyBlockingActivity(latestActivity) returns true) and the user does not approve within the --timeout period. Also when a previous approval dialog is left open from an earlier run.
Common situations: Running the CLI unattended while Trae CN waits on a tool-approval dialog; long approval buttons with a short --timeout; leftover pending dialogs from a prior session blocking the new ask.
Related errors
- No Trae CN response was visible before the timeout. The agen
- Timeout waiting for Antigravity reply after ${timeout / 1000
- ggbApplet not available after waiting. Make sure the GeoGebr
- Instagram post share confirmation did not appear
- Instagram reel preview did not appear after upload
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/c49d8550eb3a8bdb.
Report an issue: GitHub.