{"record":{"id":"f124a06b8cf2242a","repo":"zed-industries/zed","slug":"inline-assistant-stopped-before-completing-rewri","errorCode":null,"errorMessage":"Inline assistant stopped before completing `{REWRITE_SECTION_TOOL_NAME}` or `{FAILURE_MESSAGE_TOOL_NAME}` ({reason:?})","messagePattern":"Inline assistant stopped before completing `(.+?)` or `(.+?)` \\((.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/agent_ui/src/buffer_codegen.rs","lineNumber":1314,"sourceCode":"                                    failure_complete |= is_input_complete;\n                                    if is_input_complete\n                                        && codegen\n                                            .update(cx, |this, cx| {\n                                                this.failure = Some(message);\n                                                cx.notify();\n                                            })\n                                            .is_err()\n                                    {\n                                        return;\n                                    }\n                                }\n                            }\n                        }\n                    }\n                    Ok(LanguageModelCompletionEvent::UsageUpdate(token_usage)) => {\n                        *last_token_usage.lock() = token_usage;\n                    }\n                    Ok(LanguageModelCompletionEvent::Stop(reason)) => {\n                        if !failure_complete {\n                            finish_with_status(\n                                CodegenStatus::Error(anyhow!(\n                                    \"Inline assistant stopped before completing \\\n                                     `{REWRITE_SECTION_TOOL_NAME}` or \\\n                                     `{FAILURE_MESSAGE_TOOL_NAME}` ({reason:?})\"\n                                )),\n                                cx,\n                            );\n                        } else if matches!(reason, StopReason::MaxTokens | StopReason::Refusal) {\n                            finish_with_status(\n                                CodegenStatus::Error(anyhow!(\n                                    \"Inline assistant response was interrupted ({reason:?})\"\n                                )),\n                                cx,\n                            );\n                        } else {\n                            finish_with_status(CodegenStatus::Done, cx);","sourceCodeStart":1296,"sourceCodeEnd":1332,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/agent_ui/src/buffer_codegen.rs#L1296-L1332","documentation":"Emitted when the inline assistant's completion stream ends with a Stop event before the model finished either the rewrite_section or failure_message tool call. The response was cut short by a stop reason other than normal completion; the offending condition is the premature Stop(reason) on the language-model stream, leaving the edit protocol incomplete.","triggerScenarios":"Thrown at crates/agent_ui/src/buffer_codegen.rs:1312 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the inline assist — premature stops are often transient","Reduce the size of the selection being rewritten","Switch to a model with a larger output limit if the stop reason is length-related"],"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"}