{"record":{"id":"c9b5d5d2d902bb47","repo":"zed-industries/zed","slug":"inline-assistant-called-rewrite-section-tool-nam-c9b5d5","errorCode":null,"errorMessage":"Inline assistant called `{REWRITE_SECTION_TOOL_NAME}` after `{FAILURE_MESSAGE_TOOL_NAME}`","messagePattern":"Inline assistant called `(.+?)` after `(.+?)`","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/agent_ui/src/buffer_codegen.rs","lineNumber":1277,"sourceCode":"                    }\n                    return;\n                };\n\n                match event {\n                    Ok(LanguageModelCompletionEvent::StartMessage { message_id: id }) => {\n                        message_id = Some(id);\n                    }\n                    Ok(LanguageModelCompletionEvent::ToolUse(tool_use)) => {\n                        let output = match process_tool_use(tool_use) {\n                            Ok(output) => output,\n                            Err(error) => {\n                                finish_with_status(CodegenStatus::Error(error), cx);\n                                return;\n                            }\n                        };\n                        if let Some(output) = output {\n                            match output {\n                                ToolUseOutput::Rewrite { text } => {\n                                    if failure_started {\n                                        finish_with_status(\n                                            CodegenStatus::Error(anyhow!(\n                                                \"Inline assistant called \\\n                                                 `{REWRITE_SECTION_TOOL_NAME}` after \\\n                                                 `{FAILURE_MESSAGE_TOOL_NAME}`\"\n                                            )),\n                                            cx,\n                                        );\n                                        return;\n                                    }\n                                    break text;\n                                }\n                                ToolUseOutput::Failure {\n                                    message,\n                                    is_input_complete,\n                                } => {\n                                    failure_started = true;","sourceCodeStart":1259,"sourceCodeEnd":1295,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/agent_ui/src/buffer_codegen.rs#L1259-L1295","documentation":"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.","triggerScenarios":"Thrown at crates/agent_ui/src/buffer_codegen.rs:1275 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the inline assist to get a coherent single-tool response","Simplify the requested edit so the model does not mix failure reporting with rewriting"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5a9b9558db01a6b906cec2fb70a797affdc58cdd","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}