jackwener/OpenCLI · error · CommandExecutionError

Trae CN prompt submission was not verified

Error message

Trae CN prompt submission was not verified

What it means

sendTraePrompt injects the prompt and triggers submit, then polls the page for a new user turn containing that prompt until a deadline. If verification never succeeds it throws CommandExecutionError: the submit was attempted but the library cannot confirm the message actually appeared in the chat.

Source

Thrown at clis/trae-cn/utils.js:704

  if (!submitted?.ok) {
    if (submitted?.reason === 'send_button_disabled' && typeof page.pressKey === 'function') {
      await page.pressKey('Enter');
      await page.wait(0.8);
      mode = 'keyboard';
    } else {
      throw selectorError('Trae CN send button');
    }
  } else {
    await page.wait(0.8);
  }
  const deadline = Date.now() + 2500;
  while (Date.now() < deadline) {
    if (await page.evaluate(submittedPromptScript(beforeCount, prompt))) {
      return { prompt, mode };
    }
    await page.wait(0.2);
  }
  throw new CommandExecutionError(
    'Trae CN prompt submission was not verified',
    'The prompt was injected and submit was triggered, but no new user turn containing that prompt appeared.',
  );
}

export async function selectTraeModel(page, name) {
  const wanted = ensurePrompt(name);
  const wantedKey = normalizeModelLabel(wanted);
  let models = await page.evaluate(listOpenModelItemsScript());
  if (!models || models.length === 0) {
    await page.click(TRAE_CN_MODEL_TRIGGER_SELECTOR);
    await page.wait(0.8);
    models = await page.evaluate(listOpenModelItemsScript());
  }
  const exactMatch = models.find((item) => normalizeModelLabel(item.Model) === wantedKey);
  const containsMatches = exactMatch
    ? []
    : models.filter((item) => normalizeModelLabel(item.Model).includes(wantedKey));

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry the send after dismissing any dialogs in Trae CN
  2. Check the chat UI manually to see if the prompt was actually sent (it may have gone through despite failed verification)
  3. Increase polling patience or wait for the app to be idle before sending
  4. Verify Trae CN version compatibility with the library

Example fix

// before
await sendTraePrompt(page, text);
// after
await dismissDialogsIfAny(page);
await sendTraePrompt(page, text);
Defensive patterns

Strategy: retry

Validate before calling

const info = await page.evaluate(inspectTraeShellScript());
if (info?.busy || info?.dialogOpen) throw new SkipError('Trae CN busy or showing a dialog; resolve before sending');

Type guard

const isVerifiedSend = (r) => r && typeof r.prompt === 'string' && r.prompt.length > 0;

Try / catch

try { return await sendTraePrompt(page, text); } catch (e) { if (e instanceof CommandExecutionError && /not verified/.test(e.message)) { await page.wait(1); return sendTraePrompt(page, text); } throw e; }

Prevention

When it happens

Trigger: Trae CN busy/disabled composer, a modal or focus stealing the input, UI changes to message markup, or the page reloading mid-submit so the polling script never sees the new turn.

Common situations: Long-running sessions where Trae CN shows an update dialog, slow machines exceeding the poll deadline, or selector drift after a Trae CN update.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/4520b1716cdee93c. Report an issue: GitHub.