STUPID-2026-0080
Aider's unified-diff coder silently drops the partial-application warning when one hunk succeeds and another fails
Why 3/10
A partial edit lands with no warning; identified in the source code, with no victim reported.
- Scope
- 1/4
- A few files, one session, one credential, or a small cost
- Recoverability
- 1/3
- Fully recovered, with effort
- Did it happen
- 1/2
- Demonstrated (proof of concept, reproduction, controlled test or near-miss) with no real victim reported
- Beyond the user
- 0/1
- Only the user's own non-production work
The score is the sum of these four factors. How each factor is scored · scored 2026-10-29
Instruction given
None specific to this bug — the defect lives in Aider's unified-diff application logic itself and can trigger during any task where the model proposes multiple hunks in one diff and at least one hunk fails to apply while another succeeds.
Expected behavior
When `UnifiedDiffCoder.apply_edits` writes some hunks to disk successfully and rejects others, Aider should tell the user that a partial edit was applied, so they know the file on disk no longer matches either the original or the model's full intended diff.
Actual behavior
In `aider/coders/udiff_coder.py`, the function collects failed hunks into a list, joins that list into a single string for the error message, and then checks the string's length to decide whether to show the partial-application notice. After the `join`, `errors` is a string, so `len(errors)` measures characters in the error text rather than the number of failed hunks, and the length check for triggering the notice evaluates against the wrong quantity. The practical effect: when one hunk succeeds and another fails, the successful hunk is still written to disk, but the user is not reliably told that only part of the diff was applied.
Damage
Filed as a code-level defect by a reader of the source (yifanxiong272), with the exact file, function, and faulty length comparison identified, and a fix suggested (track the failed-hunk count before the `join` rather than measuring the joined string). No production incident or data loss was reported alongside it. The risk it documents is a user believing their edit either fully applied or fully failed when in fact a partial write landed on disk with no warning — the same silent-partial-success shape as Aider's already-flagged edit-format auto-selection (#5486) and headless exit-code (#5552) issues, this time in the unified-diff apply path. Open and unfixed as of this incident's publication.
Full write-up
An Aider user (yifanxiong272) reported that UnifiedDiffCoder.apply_edits, the function that writes a model's proposed unified-diff hunks to disk, loses its own partial-application warning under a specific condition: when a diff contains multiple hunks and at least one applies successfully while another fails. The function collects the failed hunks into a list, then joins that list into a single error-message string before checking its length to decide whether to surface the "some hunks applied, some didn't" notice to the user. Because the check runs on the string *after* the join, len(errors) counts characters in the assembled error text rather than the number of failed hunks — the wrong number entirely — so the length comparison that gates the warning evaluates incorrectly. The successful hunk is still written to the file regardless; what's missing is the notice telling the user that happened. The reporter pinpointed the exact file and pointed to the reversed order (measure the failed-hunk count, then join, rather than join, then measure) as the fix. No maintainer response or fix had landed as of this write-up. It's the third distinct silent-partial-success code path reported in Aider within the same week, alongside separate issues in edit-format auto-selection and headless-mode exit-code handling — different functions, same shape: work is partially or fully lost or altered with no signal reaching the user.
Classification
- Agent
- Aider
- Failure mode
- Logic Error
- Root cause
- Logic Error
- Domain
- Backend
- MIT AI Risk Repository (our mapping)
- 7.3 Lack of capability or robustness taxonomy
- Source
- Github Issue
Related incidents
Cite this record
StupidLLM. "STUPID-2026-0080: Aider's unified-diff coder silently drops the partial-application warning when one hunk succeeds and another fails." AI Agent Incident Database, 2026. https://www.stupidllm.com/incident/STUPID-2026-0080/ (accessed 2026-11-17). CC BY 4.0.
← STUPID-2026-0079By IDSTUPID-2026-0081 →
Get told when an agent breaks something
We document AI agent failures daily, severity-scored against a published scale. Each Monday, if any scored 7 or above that week — deleted data, leaked secrets, broken production — you get one email with the sources. When nothing did, you get nothing.
This database is callable over MCP — query it from inside your agent.