zed-industries/zed · error

Inline assistant called `{FAILURE_MESSAGE_TOOL_NAME}` after

Error message

Inline assistant called `{FAILURE_MESSAGE_TOOL_NAME}` after starting `{REWRITE_SECTION_TOOL_NAME}`

What it means

Raised by the inline assistant's tool-use processor when the model invokes the failure_message tool after a rewrite_section call has already started. Declaring failure after beginning a rewrite violates the single-tool protocol for inline edits; the offending input is the FAILURE_MESSAGE tool call arriving while a rewrite is in progress.

Source

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

                    }
                }
            };

            let move_last_token_usage = last_token_usage.clone();
            let move_rewrite_state = rewrite_state.clone();

            let remaining_text_stream = completion_events.filter_map(move |e| {
                let process_tool_use = process_tool_use.clone();
                let last_token_usage = move_last_token_usage.clone();
                let rewrite_state = move_rewrite_state.clone();
                async move {
                    match e {
                        Ok(LanguageModelCompletionEvent::ToolUse(tool_use)) => {
                            let output = match process_tool_use(tool_use) {
                                Ok(Some(output)) => output,
                                Ok(None) => return None,
                                Err(error) => return Some(Err(error.into())),
                            };
                            match output {
                                ToolUseOutput::Rewrite { text } => Some(Ok(text)),
                                ToolUseOutput::Failure { .. } => Some(Err(anyhow!(
                                    "Inline assistant called `{FAILURE_MESSAGE_TOOL_NAME}` \
                                     after starting `{REWRITE_SECTION_TOOL_NAME}`"
                                )
                                .into())),
                            }
                        }
                        Ok(LanguageModelCompletionEvent::UsageUpdate(token_usage)) => {
                            *last_token_usage.lock() = token_usage;
                            None
                        }
                        Ok(LanguageModelCompletionEvent::ToolUseJsonParseError {
                            tool_name,
                            json_parse_error,
                            ..
                        }) => Some(Err(anyhow!(

View on GitHub (pinned to 5a9b9558db)

Solutions

  1. Retry the inline assist so the model commits to either rewriting or failing cleanly
  2. Make the instruction unambiguous so the model does not second-guess mid-rewrite
Defensive patterns

Strategy: validation

When it happens

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