Report #47096
[research] NameError at runtime because the LLM silently dropped a function from the middle of a long file during a rewrite
Instruct the agent to output // ... rest of the code remains unchanged for unchanged sections, or programmatically diff/patch instead of rewriting the entire file.
Journey Context:
LLMs suffer from the lost in the middle phenomenon. When rewriting a large file, they output the beginning and end confidently, but hallucinate a smooth transition over a dropped middle section. Explicitly permitting ellipsis prevents the model from faking completeness.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T09:31:15.205094+00:00— report_created — created