@nhtio/adk/batteries/llm/claude_code_cli/exceptions
Battery-scoped exception constructors for the Claude Code CLI adapter.
Remarks
Battery-scoped exception classes minted via createException from @nhtio/adk/factories. Malformed NDJSON frames (either the wrapper's own inbound-command reader, or its translation of Claude's stream-json) are explicitly NOT a distinct exception — they are swallowed and surfaced via helpers.log.trace, matching the Ollama battery's malformed-line policy.
Variables
| Variable | Description |
|---|---|
| E_CLAUDE_CODE_CLI_BINARY_NOT_FOUND | Thrown when the claude binary cannot be located/spawned. |
| E_CLAUDE_CODE_CLI_MCP_BRIDGE_STARTUP_FAILED | Thrown when the wrapper's own MCP bridge server fails to start, OR Claude's system/init reports an mcp_server_errors entry naming the bridge, OR the @modelcontextprotocol/sdk optional peer is missing at wrapper startup. |
| E_CLAUDE_CODE_CLI_PROCESS_EXITED_NONZERO | Thrown when the wrapper process exits with no terminal result/error event observed. |
| E_CLAUDE_CODE_CLI_STARTUP_TIMEOUT | Thrown when the wrapper does not signal ready and Claude's system/init within startupTimeoutMs. |
| E_CLAUDE_CODE_CLI_STREAM_ERROR | Thrown on a transport-level stream failure between the adapter and the wrapper. |
| E_CLAUDE_CODE_CLI_STREAM_STALLED | Thrown when the wrapper's stdout goes idle for longer than streamIdleTimeoutMs. |
| E_CLAUDE_CODE_CLI_TURN_FAILED | Thrown when Claude's terminal result reports isError: true — includes --max-budget-usd/ --max-turns exhaustion, the CLI-native substitutes for a client-side contextWindow guard. |
| E_CLAUDE_CODE_CLI_UNSUPPORTED_MEDIA_MODALITY | Thrown when a @nhtio/adk!Media whose modality cannot be represented reaches either direction of this battery under the corresponding unsupportedMediaPolicy/ unsupportedResultMediaPolicy: 'throw' — bidirectional: inbound prompt media (a -p string has no native image channel) and outbound tool-result media (only text/image MCP content blocks are supported). |
| E_CLAUDE_CODE_CLI_WRAPPER_CRASHED | Thrown when the wrapper process crashes or exits abnormally mid-dispatch. |
| E_CLAUDE_CODE_CLI_WRAPPER_SPAWN_ERROR | Thrown when the wrapper process itself fails to spawn. |
| E_INVALID_CLAUDE_CODE_CLI_OPTIONS | Thrown when the resolved adapter options (constructor, executor overrides, or per-dispatch stash.claudeCodeCli) fail validation — including extraArgs security-flag rejection, the apiKey/authToken XOR violation, and the POSIX-only platform guard. |