zed-industries/zed · error

OpenRouter does not support custom tool calls

Error message

OpenRouter does not support custom tool calls

What it means

Raised in into_open_router when converting a message that contains a custom/tool call content kind OpenRouter's schema cannot represent. It is a capability gap sentinel: the OpenRouter provider does not support custom tool calls, so the request cannot be serialized.

Source

Thrown at crates/language_models/src/provider/open_router.rs:482

    // Anthropic models via OpenRouter don't accept reasoning_details being echoed back
    // in requests - it's an output-only field for them. However, Gemini models require
    // the thought signatures to be echoed back for proper reasoning chain continuity.
    // Note: OpenRouter's model API provides an `architecture.tokenizer` field (e.g. "Claude",
    // "Gemini") which could replace this ID prefix check, but since this is the only place
    // we need this distinction, we're just using this less invasive check instead.
    // If we ever have a more formal distionction between the models in the future,
    // we should revise this to use that instead.
    let is_anthropic_model = model.id().starts_with("anthropic/");
    let session_id = open_router_session_id(request.thread_id);

    let mut messages = Vec::new();
    let mut any_message_wants_cache = false;
    let mut last_cache_message_index: Option<usize> = None;

    for message in request.messages {
        let mut message_added_content = false;
        let reasoning_details_for_message = if is_anthropic_model {
            None
        } else {
            message.reasoning_details.clone()
        };

        let message_wants_cache = message.cache;
        if message_wants_cache {
            any_message_wants_cache = true;
        }

        for content in message.content {
            match content {
                MessageContent::Text(text) => {
                    add_message_content_part(
                        open_router::MessagePart::Text {
                            text,
                            cache_control: None,
                        },

View on GitHub (pinned to 5a9b9558db)

Solutions

  1. Disable custom tools for OpenRouter models
  2. Route through a provider/model combination that supports custom tool input
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/language_models/src/provider/open_router.rs:485 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/fa5d2e2b95e6f62e. Report an issue: GitHub.