zed-industries/zed · error

Inline assistant called `{REWRITE_SECTION_TOOL_NAME}` after

Error message

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

What it means

Raised by the inline assistant's tool-use processor when the model calls rewrite_section after it already invoked the failure_message tool. Once the model has declared failure for this assist, no further rewrite is accepted; the offending input is the out-of-order REWRITE_SECTION tool call arriving after FAILURE_MESSAGE in the completion stream.

Source

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

                    }
                    return;
                };

                match event {
                    Ok(LanguageModelCompletionEvent::StartMessage { message_id: id }) => {
                        message_id = Some(id);
                    }
                    Ok(LanguageModelCompletionEvent::ToolUse(tool_use)) => {
                        let output = match process_tool_use(tool_use) {
                            Ok(output) => output,
                            Err(error) => {
                                finish_with_status(CodegenStatus::Error(error), cx);
                                return;
                            }
                        };
                        if let Some(output) = output {
                            match output {
                                ToolUseOutput::Rewrite { text } => {
                                    if failure_started {
                                        finish_with_status(
                                            CodegenStatus::Error(anyhow!(
                                                "Inline assistant called \
                                                 `{REWRITE_SECTION_TOOL_NAME}` after \
                                                 `{FAILURE_MESSAGE_TOOL_NAME}`"
                                            )),
                                            cx,
                                        );
                                        return;
                                    }
                                    break text;
                                }
                                ToolUseOutput::Failure {
                                    message,
                                    is_input_complete,
                                } => {
                                    failure_started = true;

View on GitHub (pinned to 5a9b9558db)

Solutions

  1. Retry the inline assist to get a coherent single-tool response
  2. Simplify the requested edit so the model does not mix failure reporting with rewriting
Defensive patterns

Strategy: validation

When it happens

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