{"record":{"id":"a0a53f558f084c6c","repo":"jackwener/OpenCLI","slug":"no-trae-cn-response-was-visible-before-the-timeout","errorCode":null,"errorMessage":"No Trae CN response was visible before the timeout. The agent may still be generating.","messagePattern":"No Trae CN response was visible before the timeout\\. The agent may still be generating\\.","errorType":"exception","errorClass":"TimeoutError","httpStatus":null,"severity":"error","filePath":"clis/trae-cn/ask.js","lineNumber":97,"sourceCode":"        return [latest];\n      }\n      if (!blocked && stableFor >= 3000) {\n        return [latest];\n      }\n    }\n\n    if (latest?.Text) {\n      const blocked = isLikelyBlockingActivity(latestActivity);\n      if (blocked) {\n        throw new TimeoutError(\n          'trae-cn ask',\n          timeout,\n          `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\".`,\n        );\n      }\n      return [latest];\n    }\n    throw new TimeoutError('trae-cn ask', timeout, 'No Trae CN response was visible before the timeout. The agent may still be generating.');\n  },\n});\n","sourceCodeStart":79,"sourceCodeEnd":100,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/trae-cn/ask.js#L79-L100","documentation":"ask.js throws a TimeoutError when no Trae CN response activity was visible at all before the timeout expired, meaning the agent likely has not produced any reply yet. Unlike the blocking-activity error, there is no approval prompt detected — the composer/agent simply has nothing to return.","triggerScenarios":"Calling `opencli trae-cn ask` with a --timeout that expires before Trae CN emits any activity (latest.Text is empty/absent). Happens when the agent is still generating, the target is idle, or polling started before the prompt was processed.","commonSituations":"Very short --timeout values (e.g. 5-10s) with slow models; Trae CN window minimized or target pointed at the wrong chat; heavy generation workloads delaying the first visible response.","solutions":["Re-run with a larger --timeout (e.g. --timeout 120) to allow generation to finish.","Verify the CDP target points at an active Trae CN chat workspace via `opencli trae-cn targets -f json`.","Use `OPENCLI_CDP_TARGET=<target> opencli trae-cn watch --stream true --duration 300` to watch activity in real time.","Check connectivity to the CDP endpoint if activity is never observed."],"exampleFix":"// before\nopencli trae-cn ask \"summarize repo\" --timeout 10\n// after\nopencli trae-cn ask \"summarize repo\" --timeout 180","handlingStrategy":"retry","validationCode":"// Verify the CDP endpoint responds before asking\nconst res = await fetch(`${process.env.OPENCLI_CDP_ENDPOINT ?? 'http://127.0.0.1:39240'}/json`, { signal: AbortSignal.timeout(5000) });\nif (!res.ok) throw new Error(`CDP endpoint unhealthy: HTTP ${res.status}`);","typeGuard":"function hasVisibleResponse(activity) {\n  return Boolean(activity && typeof activity === 'object' && typeof activity.Text === 'string' && activity.Text.length > 0);\n}","tryCatchPattern":"try {\n  return await runAsk(timeout);\n} catch (e) {\n  if (e instanceof TimeoutError && e.message.includes('No Trae CN response was visible')) {\n    await sleep(5000);\n    return runAsk(Math.min(timeout * 2, 900)); // retry with doubled timeout\n  }\n  throw e;\n}","preventionTips":["Start with a large --timeout (120s+) for slow generations.","Confirm the CDP target points at an active chat workspace.","Pre-check endpoint health with a quick /json fetch.","Watch stream output live on first runs to calibrate timeout."],"tags":["timeout","no-response","cdp","automation"],"backgroundTag":"agent-response-timeout","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}