{"record":{"id":"833bf95a512ed663","repo":"nikivdev/code","slug":"error-833bf9","errorCode":null,"errorMessage":"{error}","messagePattern":"\\{error\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/codex_telemetry.rs","lineNumber":464,"sourceCode":"        .filter(|value| !value.is_empty())\n        .or_else(|| Some(\"Maple tool returned an unspecified error\".to_string()))\n}\n\nfn maple_call_tool(\n    config: &MapleReadConfig,\n    name: &str,\n    arguments: serde_json::Value,\n) -> Result<serde_json::Value> {\n    let result = maple_json_rpc_request(\n        config,\n        \"tools/call\",\n        serde_json::json!({\n            \"name\": name,\n            \"arguments\": arguments,\n        }),\n    )?;\n    if let Some(error) = maple_tool_result_error(&result) {\n        anyhow::bail!(\"{error}\");\n    }\n    Ok(result)\n}\n\npub fn status() -> Result<CodexTelemetryStatus> {\n    let config = parse_maple_exporter_config_from_env()?;\n    let state = load_state()?;\n    let state_path = telemetry_state_path()?;\n    let events_path = codex_skill_eval::events_log_path()?;\n    let outcomes_path = codex_skill_eval::outcomes_log_path()?;\n\n    Ok(CodexTelemetryStatus {\n        enabled: config.is_some(),\n        configured_targets: config\n            .as_ref()\n            .map(|value| value.targets.len())\n            .unwrap_or(0),\n        service_name: config","sourceCodeStart":446,"sourceCodeEnd":482,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/codex_telemetry.rs#L446-L482","documentation":"This error is raised by `maple_call_tool` when the JSON-RPC call itself succeeded (no envelope-level error) but the tool's *result* payload embeds a domain-level error, detected by `maple_tool_result_error`. The library re-bails with that inner error string verbatim (`{error}`), so the message text comes from the Maple tool, not from this crate. It marks the difference between transport/protocol failures and tool-execution failures.","triggerScenarios":"`maple_call_tool` (called by `inspect_trace`) obtains a result envelope where `maple_tool_result_error(&result)` returns `Some`, e.g. the tool reports 'trace not found', permission denied for the trace, or an internal tool failure, and the function bails with that string.","commonSituations":"Querying a trace_id that has been flushed/expired on the server, requesting a trace owned by another API token (RBAC denial), or the Maple tool hitting an internal error while aggregating telemetry.","solutions":["Act on the inner message: if the trace is not found, flush first (`inspect_trace` with flush_first=true) and re-check the trace_id.","Verify the MAPLE_API_TOKEN has access to the requested trace/workspace.","Retry the tool call if the message indicates a transient internal error.","Check Maple server logs for the tool-side failure if the message is opaque."],"exampleFix":"// before: inspecting a stale trace id\ninspect_trace(\"abc123\", false)?;\n// after: flush pending telemetry first so the trace exists server-side\ninspect_trace(\"abc123\", true)?;","handlingStrategy":"try-catch","validationCode":"// ensure a trace id exists before inspecting it\nlet known = list_recent_trace_ids()?;\nif !known.contains(&trace_id.to_string()) {\n    eprintln!(\"trace {trace_id} unknown; flushing telemetry first\");\n    flush(64);\n}","typeGuard":"fn tool_result_ok(result: &serde_json::Value) -> bool {\n    maple_tool_result_error(result).is_none()\n}","tryCatchPattern":"match maple_call_tool(\"inspect_trace\", args) {\n    Err(e) if !e.to_string().contains(\"Maple MCP\") => {\n        // tool-level (domain) error: inspect the message for 'not found' / 'denied'\n        eprintln!(\"Maple tool failed: {e}\");\n    }\n    Err(e) => return Err(e),\n    Ok(r) => r,\n}","preventionTips":["Always flush pending telemetry before querying a fresh trace id","Check token permissions for the target workspace/trace","Retry tool calls on transient internal errors with backoff","Keep the inner error text in logs — it comes from the Maple tool and is diagnostic"],"tags":["mcp","api","tool-execution","telemetry"],"backgroundTag":"remote-tool-execution-error","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}