nexu-io/open-design · error · Error

${agentName} CLI error: ${message}

Error message

${agentName} CLI error: ${message}

What it means

The JSON event stream from a local agent CLI (codex or opencode) contained an event with type: 'error'. The extractJsonEventText function parses the streamed NDJSON events and throws when it finds an error event, surfacing the event's message field.

Source

Thrown at apps/daemon/src/memory-llm.ts:941

  }
  return '';
}

const LOCAL_CLI_TIMEOUT_MS = 60_000;

function extractJsonEventText(kind, raw, agentName) {
  const events = [];
  const handler = createJsonEventStreamHandler(kind, (event) => events.push(event));
  handler.feed(raw);
  handler.flush();

  const errorEvent = events.find((event) => event?.type === 'error');
  if (errorEvent) {
    const message =
      typeof errorEvent.message === 'string' && errorEvent.message.trim()
        ? errorEvent.message.trim()
        : 'unknown error';
    throw new Error(`${agentName} CLI error: ${message}`);
  }

  return events
    .filter((event) => event?.type === 'text_delta' && typeof event.delta === 'string')
    .map((event) => event.delta)
    .join('')
    .trim();
}

async function callLocalCli(provider, system, user, options) {
  if (typeof options?.localCliRunner === 'function') {
    return options.localCliRunner({
      agentId: provider.agentId,
      model: provider.model,
      system,
      user,
      projectRoot: options?.projectRoot ?? null,
      dataDir: options?.dataDir ?? null,

View on GitHub (pinned to 5be4028344)

Solutions

  1. Read the error message surfaced from the agent CLI in the thrown error
  2. Verify the agent CLI is properly authenticated (run the agent manually to test)
  3. Confirm provider.model is available and configured for the agent
  4. Run the agent CLI manually with the same prompt to reproduce the error
  5. Update the agent CLI to the latest version
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const text = await callLocalCli(provider, system, user, options);
} catch (err) {
  if (err.message.includes('CLI error:')) {
    // Agent CLI reported an error event — check agent config and auth
    logger.error('Agent CLI error during memory extraction', { agentId: provider.agentId, error: err.message });
    // Optionally fall back to an HTTP provider
    throw err;
  }
  throw err;
}

Prevention

When it happens

Trigger: The agent CLI process encountered an internal error during memory extraction; the selected model is unavailable or misconfigured; authentication failure within the agent's own provider config; the agent CLI crashed or exited with an error event.

Common situations: Agent CLI version incompatibility with the daemon's event parser; model not configured for the agent in agentCliEnv; API key missing for the agent's underlying provider; agent crashed mid-extraction due to prompt issues.

Related errors


AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12). Data as JSON: /api/errors/010606796e0458e4. Report an issue: GitHub.