zed-industries/zed · error · anyhow::Error

OpenAI Chat Completions cannot replay custom tool call `{}`

Error message

OpenAI Chat Completions cannot replay custom tool call `{}`

What it means

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.

Source

Thrown at crates/open_ai/src/completion.rs:126

                        }
                    }
                }
                MessageContent::RedactedThinking(_) | MessageContent::Compaction(_) => {}
                MessageContent::Image(image) => {
                    add_message_content_part(
                        MessagePart::Image {
                            image_url: ImageUrl {
                                url: image.to_base64_url(),
                                detail: None,
                            },
                        },
                        message.role,
                        &mut messages,
                        reasoning_details.clone(),
                    );
                }
                MessageContent::ToolUse(tool_use) => {
                    let LanguageModelToolUseInput::Json(input) = &tool_use.input else {
                        return Err(anyhow!(
                            "OpenAI Chat Completions cannot replay custom tool call `{}`",
                            tool_use.name
                        ));
                    };
                    let tool_call = ToolCall {
                        id: tool_use.id.to_string(),
                        content: ToolCallContent::Function {
                            function: FunctionContent {
                                name: tool_use.name.to_string(),
                                arguments: serde_json::to_string(input).unwrap_or_default(),
                                thought_signature: interleaved_reasoning
                                    .then(|| tool_use.thought_signature.clone())
                                    .flatten(),
                            },
                        },
                    };

View on GitHub (pinned to 5a9b9558db)

Solutions

  1. Start a new conversation/thread without the custom tool call history
  2. Route the conversation through the Responses API which can replay custom calls
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/open_ai/src/completion.rs:126 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@5a9b9558db (2026-08-20). Data as JSON: /api/errors/4597e33b3cf79190. Report an issue: GitHub.