jackwener/OpenCLI · error · TimeoutError

No Trae CN response was visible before the timeout. The agen

Error message

No Trae CN response was visible before the timeout. The agent may still be generating.

What it means

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.

Source

Thrown at clis/trae-cn/ask.js:97

        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

  1. Re-run with a larger --timeout (e.g. --timeout 120) to allow generation to finish.
  2. Verify the CDP target points at an active Trae CN chat workspace via `opencli trae-cn targets -f json`.
  3. Use `OPENCLI_CDP_TARGET=<target> opencli trae-cn watch --stream true --duration 300` to watch activity in real time.
  4. Check connectivity to the CDP endpoint if activity is never observed.

Example fix

// before
opencli trae-cn ask "summarize repo" --timeout 10
// after
opencli trae-cn ask "summarize repo" --timeout 180
Defensive patterns

Strategy: retry

Validate before calling

// Verify the CDP endpoint responds before asking
const res = await fetch(`${process.env.OPENCLI_CDP_ENDPOINT ?? 'http://127.0.0.1:39240'}/json`, { signal: AbortSignal.timeout(5000) });
if (!res.ok) throw new Error(`CDP endpoint unhealthy: HTTP ${res.status}`);

Type guard

function hasVisibleResponse(activity) {
  return Boolean(activity && typeof activity === 'object' && typeof activity.Text === 'string' && activity.Text.length > 0);
}

Try / catch

try {
  return await runAsk(timeout);
} catch (e) {
  if (e instanceof TimeoutError && e.message.includes('No Trae CN response was visible')) {
    await sleep(5000);
    return runAsk(Math.min(timeout * 2, 900)); // retry with doubled timeout
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Related errors


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