{"record":{"id":"b7fc4b18d9dc84bd","repo":"zeroclaw-labs/zeroclaw","slug":"nativechatrequest-should-serialize-to-json","errorCode":null,"errorMessage":"NativeChatRequest should serialize to JSON","messagePattern":"NativeChatRequest should serialize to JSON","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-providers/src/anthropic.rs","lineNumber":2584,"sourceCode":"                        \"tool_choice\": tool_choice.as_ref().and_then(|value| value.get(\"type\")).and_then(|value| value.as_str()),\n                    })),\n                \"native thinking enabled; using non-streaming fallback to preserve signed thinking blocks\"\n            );\n            let native_request = NativeChatRequest {\n                model: model.to_string(),\n                max_tokens: effective_max_tokens,\n                system: system_prompt,\n                messages,\n                temperature: effective_temperature,\n                tools: native_tools,\n                tool_choice,\n                stream: None,\n                thinking: thinking_config,\n            };\n            // Serialize eagerly so the request body is owned and `'static`\n            // across the async boundary.\n            let body = serde_json::to_value(&native_request)\n                .expect(\"NativeChatRequest should serialize to JSON\");\n            let client = self.http_client();\n            let url = format!(\"{}/v1/messages\", self.base_url);\n            let is_oauth = Self::is_setup_token(&credential);\n\n            return stream::once(async move {\n                let mut req = client\n                    .post(&url)\n                    .header(\"anthropic-version\", \"2023-06-01\")\n                    .header(\"content-type\", \"application/json\")\n                    .json(&body);\n                if is_oauth {\n                    req = req\n                        .header(\"Authorization\", format!(\"Bearer {credential}\"))\n                        .header(\n                            \"anthropic-beta\",\n                            \"claude-code-20250219,oauth-2025-04-20,interleaved-thinking-2025-05-14\",\n                        )\n                        .header(\"anthropic-dangerous-direct-browser-access\", \"true\");","sourceCodeStart":2566,"sourceCodeEnd":2602,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-providers/src/anthropic.rs#L2566-L2602","documentation":"Error \"NativeChatRequest should serialize to JSON\" thrown in zeroclaw-labs/zeroclaw.","triggerScenarios":"Thrown at crates/zeroclaw-providers/src/anthropic.rs:2584 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["This invariant failure indicates a serialization bug; report it with the request payload that triggered it.","Validate the request fields against the Anthropic schema to find the value that breaks serialization."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}