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
- Read the error message surfaced from the agent CLI in the thrown error
- Verify the agent CLI is properly authenticated (run the agent manually to test)
- Confirm provider.model is available and configured for the agent
- Run the agent CLI manually with the same prompt to reproduce the error
- 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
- Test the agent CLI manually with a simple prompt before relying on it for memory extraction
- Keep agent CLI versions updated and compatible with the daemon's event parser
- Ensure the agent's underlying provider API key is configured in agentCliEnv
- Consider falling back to an HTTP-based LLM provider if agent CLI extraction is unreliable
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
- anthropic ${resp.status}: ${await resp.text().catch(() => ''
- openai ${resp.status}: ${await resp.text().catch(() => '')}
- azure ${resp.status}: ${await resp.text().catch(() => '')}
- google ${resp.status}: ${await resp.text().catch(() => '')}
- Local CLI agent "${provider.agentId}" is not installed
AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12).
Data as JSON: /api/errors/010606796e0458e4.
Report an issue: GitHub.