ResultMessage missing errors field from Claude JSON output

Resolved 💬 1 comment Opened Jan 21, 2026 by meawoppl Closed Jan 21, 2026

Issue

When Claude Code returns an error result (e.g., "No conversation found with session ID"), the JSON includes an errors array that is not captured by the ResultMessage struct.

Example JSON from Claude

{
  "type": "result",
  "subtype": "error_during_execution",
  "duration_ms": 0,
  "duration_api_ms": 0,
  "is_error": true,
  "num_turns": 0,
  "session_id": "27934753-425a-4182-892c-6b1c15050c3f",
  "total_cost_usd": 0,
  "errors": ["No conversation found with session ID: d56965c9-c855-4042-a8f5-f12bbb14d6f6"],
  ...
}

Current ResultMessage struct

pub struct ResultMessage {
    pub subtype: ResultSubtype,
    pub is_error: bool,
    pub duration_ms: u64,
    pub duration_api_ms: u64,
    pub num_turns: i32,
    pub result: Option<String>,
    pub session_id: String,
    pub total_cost_usd: f64,
    pub usage: Option<UsageInfo>,
    pub permission_denials: Vec<Value>,
    pub uuid: Option<String>,
}

Suggestion

Add an errors field to ResultMessage:

#[serde(default)]
pub errors: Vec<String>,

This would allow consumers to properly detect and handle specific error conditions like "No conversation found" without having to serialize back to JSON and string-search.

Use Case

When resuming a Claude session that no longer exists, Claude returns this error. Applications wrapping claude-codes need to detect this to restart with a fresh session instead of failing.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗