{"record":{"id":"4597e33b3cf79190","repo":"zed-industries/zed","slug":"openai-chat-completions-cannot-replay-custom-tool","errorCode":null,"errorMessage":"OpenAI Chat Completions cannot replay custom tool call `{}`","messagePattern":"OpenAI Chat Completions cannot replay custom tool call `(.+?)`","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/open_ai/src/completion.rs","lineNumber":126,"sourceCode":"                        }\n                    }\n                }\n                MessageContent::RedactedThinking(_) | MessageContent::Compaction(_) => {}\n                MessageContent::Image(image) => {\n                    add_message_content_part(\n                        MessagePart::Image {\n                            image_url: ImageUrl {\n                                url: image.to_base64_url(),\n                                detail: None,\n                            },\n                        },\n                        message.role,\n                        &mut messages,\n                        reasoning_details.clone(),\n                    );\n                }\n                MessageContent::ToolUse(tool_use) => {\n                    let LanguageModelToolUseInput::Json(input) = &tool_use.input else {\n                        return Err(anyhow!(\n                            \"OpenAI Chat Completions cannot replay custom tool call `{}`\",\n                            tool_use.name\n                        ));\n                    };\n                    let tool_call = ToolCall {\n                        id: tool_use.id.to_string(),\n                        content: ToolCallContent::Function {\n                            function: FunctionContent {\n                                name: tool_use.name.to_string(),\n                                arguments: serde_json::to_string(input).unwrap_or_default(),\n                                thought_signature: interleaved_reasoning\n                                    .then(|| tool_use.thought_signature.clone())\n                                    .flatten(),\n                            },\n                        },\n                    };\n","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/open_ai/src/completion.rs#L108-L144","documentation":"Replay guard in into_open_ai: an assistant message contains a ToolUse block for a custom tool call; Chat Completions has no way to re-send that historical call, so transcript conversion fails naming the offending tool.","triggerScenarios":"Thrown at crates/open_ai/src/completion.rs:126 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Start a new conversation/thread without the custom tool call history","Route the conversation through the Responses API which can replay custom calls"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5a9b9558db01a6b906cec2fb70a797affdc58cdd","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}