{"record":{"id":"5157e0a2de2e9992","repo":"zed-industries/zed","slug":"inline-assistant-stopped-before-completing-rewri-5157e0","errorCode":null,"errorMessage":"Inline assistant stopped before completing `{REWRITE_SECTION_TOOL_NAME}` ({reason:?})","messagePattern":"Inline assistant stopped before completing `(.+?)` \\((.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/agent_ui/src/buffer_codegen.rs","lineNumber":1406,"sourceCode":"                            }\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!(\n                            \"Invalid input for inline assistant tool \\\n                             `{tool_name}`: {json_parse_error}\"\n                        )\n                        .into())),\n                        Ok(LanguageModelCompletionEvent::Stop(reason)) => {\n                            let rewrite_complete = rewrite_state\n                                .lock()\n                                .as_ref()\n                                .is_some_and(|state| state.is_input_complete);\n                            if !rewrite_complete {\n                                Some(Err(anyhow!(\n                                    \"Inline assistant stopped before completing \\\n                                         `{REWRITE_SECTION_TOOL_NAME}` ({reason:?})\"\n                                )\n                                .into()))\n                            } else if matches!(reason, StopReason::MaxTokens | StopReason::Refusal)\n                            {\n                                Some(Err(anyhow!(\n                                    \"Inline assistant response was interrupted ({reason:?})\"\n                                )\n                                .into()))\n                            } else {\n                                None\n                            }\n                        }\n                        Ok(","sourceCodeStart":1388,"sourceCodeEnd":1424,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/agent_ui/src/buffer_codegen.rs#L1388-L1424","documentation":"Emitted in the streaming phase after the first rewrite_section tool has started: the completion stream stops (Stop event) before the in-progress rewrite completes. Unlike the pre-rewrite stop, this fires mid-edit; the offending condition is a premature Stop(reason) truncating the model's output while the rewrite payload is still incomplete.","triggerScenarios":"Thrown at crates/agent_ui/src/buffer_codegen.rs:1404 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the inline assist — mid-rewrite truncation is usually transient","Shrink the selection or instruction so the rewrite payload fits the output limit","Use a model with a larger output budget for long rewrites"],"exampleFix":null,"handlingStrategy":"retry","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"}