jackwener/OpenCLI · error · CommandExecutionError
Clicked Trae CN new task via ${clicked.method}; fresh empty
Error message
Clicked Trae CN new task via ${clicked.method}; fresh empty composer was not confirmed What it means
new.js throws a CommandExecutionError when, after clicking the new-task control, repeated probes of the page state never confirm a fresh empty composer (composerReady and turns===0). The error reports which click method was used and the observed composerReady/turns values so you can diagnose whether the click landed at all.
Source
Thrown at clis/trae-cn/new.js:35
],
columns: ['Status', 'Action', 'Workspace', 'Model', 'Agent', 'FreshTaskConfirmed', 'TurnsBeforeSubmit', 'Turns', 'ComposerReady', 'SubmitMode'],
func: async (page, kwargs) => {
const timeout = normalizeTimeout(kwargs.timeout, 10);
const clicked = await page.evaluate(clickNewTaskScript());
if (!clicked?.ok) {
throw selectorError('Trae CN new task button');
}
const started = Date.now();
let state = null;
while (Date.now() - started < timeout * 1000) {
await page.wait(0.5);
state = await page.evaluate(currentTaskStateScript());
if (state?.composerReady && state.turns === 0) break;
}
if (!state?.composerReady || state.turns !== 0) {
throw new CommandExecutionError(
`Clicked Trae CN new task via ${clicked.method}; fresh empty composer was not confirmed`,
`Observed composerReady=${state?.composerReady ? 'yes' : 'no'}, turns=${state?.turns ?? 'unavailable'}. Verify the current window is a Trae CN chat workspace and retry.`,
);
}
const turnsBeforeSubmit = state.turns;
let submitMode = '';
if (kwargs.prompt !== undefined && kwargs.prompt !== null && String(kwargs.prompt).trim()) {
const result = await sendTraePrompt(page, ensurePrompt(kwargs.prompt));
submitMode = result.mode;
await page.wait(0.5);
state = await page.evaluate(currentTaskStateScript());
}
return [{
Status: 'Success',
Action: kwargs.prompt ? `New task created via ${clicked.method}; prompt submitted` : `New task created via ${clicked.method}`,
Workspace: state?.workspace || '',View on GitHub (pinned to 49907e53dc)
Solutions
- Confirm the active window/tab is a Trae CN chat workspace, then retry `opencli trae-cn new`.
- Check whether a recent Trae CN update changed the UI and update the click selectors/currentTaskStateScript.
- Increase probe attempts/wait interval in new.js if the app is slow to reset.
- Manually start a new task in Trae CN and verify the composer state script returns composerReady=true, turns=0.
Example fix
// before (new.js)
if (!state?.composerReady || state.turns !== 0) {
throw new CommandExecutionError(`Clicked Trae CN new task via ${clicked.method}; fresh empty composer was not confirmed`, ...);
}
// after: increase probe patience
for (let i = 0; i < 20; i++) {
await page.wait(1); // was 0.5
state = await page.evaluate(currentTaskStateScript());
if (state?.composerReady && state.turns === 0) break;
} Defensive patterns
Strategy: validation
Validate before calling
// Verify the current target is a chat workspace before new
const state = await page.evaluate(currentTaskStateScript());
if (!state || typeof state.composerReady === 'undefined') {
throw new Error('Current page is not a Trae CN chat workspace; switch targets first.');
} Type guard
function isFreshComposerState(state) {
return Boolean(state && typeof state === 'object' &&
state.composerReady === true && Number.isInteger(state.turns) && state.turns === 0);
} Try / catch
try {
await createNewTask();
} catch (e) {
if (e instanceof CommandExecutionError && /fresh empty composer was not confirmed/.test(e.message)) {
console.error(e.message, e.detail); // inspect composerReady/turns
// retry once after re-focusing the correct CDP target
await focusChatTarget();
return createNewTask();
}
throw e;
} Prevention
- Ensure the Trae CN window shows a chat workspace, not settings or another panel.
- After Trae CN updates, re-verify UI selectors used by the new-task click.
- Pick a stable CDP target via `opencli trae-cn targets -f json` before automating.
- Allow extra settle time on slow machines.
When it happens
Trigger: Running `opencli trae-cn new` when the click method (selector/keyboard) did not create a new task: wrong window focused, page not a chat workspace, UI selectors changed after a Trae CN update, or the new task took longer than the probe loop allowed.
Common situations: Trae CN app updated and DOM selectors for the new-task button changed; user is looking at a settings or non-chat panel; slow machine where 0.5s-interval probes exhaust retries before the composer resets.
Related errors
- Knowledge button not found
- Marketplace button not found
- Credits Usage not visible
- View all button not visible
- Add Workspace button not found
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/d4a5bde726f55e2e.
Report an issue: GitHub.