{"record":{"id":"270e8dcedc3ad122","repo":"zed-industries/zed","slug":"inline-assistant-called-failure-message-tool-nam","errorCode":null,"errorMessage":"Inline assistant called `{FAILURE_MESSAGE_TOOL_NAME}` after starting `{REWRITE_SECTION_TOOL_NAME}`","messagePattern":"Inline assistant called `(.+?)` after starting `(.+?)`","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/agent_ui/src/buffer_codegen.rs","lineNumber":1380,"sourceCode":"                    }\n                }\n            };\n\n            let move_last_token_usage = last_token_usage.clone();\n            let move_rewrite_state = rewrite_state.clone();\n\n            let remaining_text_stream = completion_events.filter_map(move |e| {\n                let process_tool_use = process_tool_use.clone();\n                let last_token_usage = move_last_token_usage.clone();\n                let rewrite_state = move_rewrite_state.clone();\n                async move {\n                    match e {\n                        Ok(LanguageModelCompletionEvent::ToolUse(tool_use)) => {\n                            let output = match process_tool_use(tool_use) {\n                                Ok(Some(output)) => output,\n                                Ok(None) => return None,\n                                Err(error) => return Some(Err(error.into())),\n                            };\n                            match output {\n                                ToolUseOutput::Rewrite { text } => Some(Ok(text)),\n                                ToolUseOutput::Failure { .. } => Some(Err(anyhow!(\n                                    \"Inline assistant called `{FAILURE_MESSAGE_TOOL_NAME}` \\\n                                     after starting `{REWRITE_SECTION_TOOL_NAME}`\"\n                                )\n                                .into())),\n                            }\n                        }\n                        Ok(LanguageModelCompletionEvent::UsageUpdate(token_usage)) => {\n                            *last_token_usage.lock() = token_usage;\n                            None\n                        }\n                        Ok(LanguageModelCompletionEvent::ToolUseJsonParseError {\n                            tool_name,\n                            json_parse_error,\n                            ..\n                        }) => Some(Err(anyhow!(","sourceCodeStart":1362,"sourceCodeEnd":1398,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/agent_ui/src/buffer_codegen.rs#L1362-L1398","documentation":"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.","triggerScenarios":"Thrown at crates/agent_ui/src/buffer_codegen.rs:1378 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the inline assist so the model commits to either rewriting or failing cleanly","Make the instruction unambiguous so the model does not second-guess mid-rewrite"],"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"}