{"record":{"id":"4520b1716cdee93c","repo":"jackwener/OpenCLI","slug":"trae-cn-prompt-submission-was-not-verified","errorCode":null,"errorMessage":"Trae CN prompt submission was not verified","messagePattern":"Trae CN prompt submission was not verified","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/trae-cn/utils.js","lineNumber":704,"sourceCode":"  if (!submitted?.ok) {\n    if (submitted?.reason === 'send_button_disabled' && typeof page.pressKey === 'function') {\n      await page.pressKey('Enter');\n      await page.wait(0.8);\n      mode = 'keyboard';\n    } else {\n      throw selectorError('Trae CN send button');\n    }\n  } else {\n    await page.wait(0.8);\n  }\n  const deadline = Date.now() + 2500;\n  while (Date.now() < deadline) {\n    if (await page.evaluate(submittedPromptScript(beforeCount, prompt))) {\n      return { prompt, mode };\n    }\n    await page.wait(0.2);\n  }\n  throw new CommandExecutionError(\n    'Trae CN prompt submission was not verified',\n    'The prompt was injected and submit was triggered, but no new user turn containing that prompt appeared.',\n  );\n}\n\nexport async function selectTraeModel(page, name) {\n  const wanted = ensurePrompt(name);\n  const wantedKey = normalizeModelLabel(wanted);\n  let models = await page.evaluate(listOpenModelItemsScript());\n  if (!models || models.length === 0) {\n    await page.click(TRAE_CN_MODEL_TRIGGER_SELECTOR);\n    await page.wait(0.8);\n    models = await page.evaluate(listOpenModelItemsScript());\n  }\n  const exactMatch = models.find((item) => normalizeModelLabel(item.Model) === wantedKey);\n  const containsMatches = exactMatch\n    ? []\n    : models.filter((item) => normalizeModelLabel(item.Model).includes(wantedKey));","sourceCodeStart":686,"sourceCodeEnd":722,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/trae-cn/utils.js#L686-L722","documentation":"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.","triggerScenarios":"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.","commonSituations":"Long-running sessions where Trae CN shows an update dialog, slow machines exceeding the poll deadline, or selector drift after a Trae CN update.","solutions":["Retry the send after dismissing any dialogs in Trae CN","Check the chat UI manually to see if the prompt was actually sent (it may have gone through despite failed verification)","Increase polling patience or wait for the app to be idle before sending","Verify Trae CN version compatibility with the library"],"exampleFix":"// before\nawait sendTraePrompt(page, text);\n// after\nawait dismissDialogsIfAny(page);\nawait sendTraePrompt(page, text);","handlingStrategy":"retry","validationCode":"const info = await page.evaluate(inspectTraeShellScript());\nif (info?.busy || info?.dialogOpen) throw new SkipError('Trae CN busy or showing a dialog; resolve before sending');","typeGuard":"const isVerifiedSend = (r) => r && typeof r.prompt === 'string' && r.prompt.length > 0;","tryCatchPattern":"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; }","preventionTips":["Retry once after a short wait before surfacing the error","Dismiss dialogs and focus the composer before sending","Keep the library and Trae CN versions in sync"],"tags":["automation","verification-timeout","ui-automation"],"backgroundTag":"automation-verification-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}