zed-industries/zed · error

Invalid input for inline assistant tool `{tool_name}`: {json

Error message

Invalid input for inline assistant tool `{tool_name}`: {json_parse_error}

What it means

Raised when a tool call in the inline assistant's completion stream carries JSON input that fails to parse into the expected tool input type (RewriteSectionInput or the failure-message input). The offending input is the raw tool_name plus its malformed JSON payload from the model; note that incomplete streaming input is waited on, so this fires only for truly unparseable complete JSON.

Source

Thrown at crates/agent_ui/src/buffer_codegen.rs:1339

                                )),
                                cx,
                            );
                        } else if matches!(reason, StopReason::MaxTokens | StopReason::Refusal) {
                            finish_with_status(
                                CodegenStatus::Error(anyhow!(
                                    "Inline assistant response was interrupted ({reason:?})"
                                )),
                                cx,
                            );
                        } else {
                            finish_with_status(CodegenStatus::Done, cx);
                        }
                        return;
                    }
                    Ok(LanguageModelCompletionEvent::ToolUseJsonParseError {
                        tool_name,
                        json_parse_error,
                        ..
                    }) => {
                        finish_with_status(
                            CodegenStatus::Error(anyhow!(
                                "Invalid input for inline assistant tool \
                                 `{tool_name}`: {json_parse_error}"
                            )),
                            cx,
                        );
                        return;
                    }
                    Ok(
                        LanguageModelCompletionEvent::Queued { .. }
                        | LanguageModelCompletionEvent::Started
                        | LanguageModelCompletionEvent::Text(_)
                        | LanguageModelCompletionEvent::Thinking { .. }
                        | LanguageModelCompletionEvent::RedactedThinking { .. }
                        | LanguageModelCompletionEvent::ReasoningDetails(_)
                        | LanguageModelCompletionEvent::Compaction(_),

View on GitHub (pinned to 5a9b9558db)

Solutions

  1. Retry the inline assist — malformed tool JSON is usually a transient model error
  2. Simplify the edit request to reduce the complexity of generated tool input
  3. Switch models if one provider repeatedly emits invalid tool JSON
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/agent_ui/src/buffer_codegen.rs:1337 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/eb167000dbfcee89. Report an issue: GitHub.