Answer: Aider tries to be very flexible when applying diffs, using strategies such as normalizing the hunk, discovering unmarked added lines, applying with relative leading white space, breaking large hunks into smaller sub-hunks, and varying the context window size and offset. Status: Confirmed Entry: tool/aider/troubleshooting/flexible-edit-application Revision: 1 Digest: sha256:16b7e893db35d855 (changes whenever the content changes) Timeline: Created: 2026-11-15T11:45:59Z Last changed: 2026-11-15T11:45:59Z Last verified: 2026-11-20T11:43:52Z Next check: 2026-11-21T11:43:52Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of approach | Aider tries to be very flexible when applying diffs, in order to handle defects | [1] | 2026-11-20 strategy 1 | Normalize the hunk | [1] | 2026-11-20 strategy 2 | Try and discover new lines that GPT is trying to add but which it forgot to mark with plus + markers | [1] | 2026-11-20 strategy 3 | Try and apply the hunk using “relative leading white space” | [1] | 2026-11-20 strategy 4 | Break a large hunk apart into an overlapping sequence of smaller hunks | [1] | 2026-11-20 strategy 5 | Vary the size and offset of the “context window” | [1] | 2026-11-20 strategy 6 | Combine the above mechanisms to progressively become more permissive about how to apply the hunk | [1] | 2026-11-20 error increase | 9X | [1] | 2026-11-20 Sources: [1] Aider. "aider.chat/docs/unified-diffs.html". https://aider.chat/docs/unified-diffs.html Role: primary. Accessed: 2026-11-20T11:43:52Z Quote: "Aider tries to be very flexible when applying diffs, in order to handle defects." (Supports: approach) Quote: "Normalize the hunk, by taking the minus - and space lines as one version of the hunk and the space and plus + lines as a second version and doing an actual unified diff on them." (Supports: strategy 1) Quote: "Try and discover new lines that GPT is trying to add but which it forgot to mark with plus + markers." (Supports: strategy 2) Quote: "Try and apply the hunk using “relative leading white space”, so we can match and patch correctly even if the hunk has been uniformly indented or outdented." (Supports: strategy 3) Quote: "Break a large hunk apart into an overlapping sequence of smaller hunks, which each contain only one contiguous run of plus + and minus - lines." (Supports: strategy 4) Quote: "Vary the size and offset of the “context window” of space lines from the hunk that are used to localize the edit to a specific part of the file." (Supports: strategy 5) Quote: "Combine the above mechanisms to progressively become more permissive about how to apply the hunk." (Supports: strategy 6) Quote: "Experiments where flexible patching is disabled show a 9X increase in editing errors on aider’s original Exercism benchmark." (Supports: error increase) Published: 2026-04-25T16:45:23Z Snapshot SHA-256: 96c359f0d91a127021c6bfc2eeb2a7a1b3cb8d17dd8572701259238025a0d16b (captured 2026-11-13T02:56:41Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-15T11:45:59Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T11:43:52Z. No independent second source is configured for this entry Last successful check: 2026-11-20T11:43:52Z Last attempt: 2026-11-20T11:43:52Z Notes and limitations: Extracted automatically from a single official source (section "Be flexible when applying edits"). Related: https://latestn.com/tool/aider/troubleshooting/get-more-help How do I get more help or support with Aider beyond the /help command? https://latestn.com/tool/aider/troubleshooting/lm-studio-dummy-api-key Why does Aider fail with an empty Bearer token when using LM Studio? https://latestn.com/tool/aider/troubleshooting/missing-environment-variables-warning How do I resolve the "Missing environment variables" warning in Aider? https://latestn.com/tool/aider/troubleshooting/fix-output-token-limit-errors How do I resolve Aider errors from exceeding the output token limit? https://latestn.com/tool/aider/troubleshooting/fix-unknown-context-window-warning How do I fix the "Unknown context window size and token costs" warning in Aider? https://latestn.com/tool/aider/troubleshooting/fix-unknown-required-env-vars How do I fix the warning that Aider doesn't know which environment variables a model requires? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-15T11:45:59Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/aider/troubleshooting/flexible-edit-application/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/aider/troubleshooting/flexible-edit-application POST: https://latestn.com/dispute/tool/aider/troubleshooting/flexible-edit-application with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/aider/troubleshooting/flexible-edit-application?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How does Aider apply edits when the model's diff doesn't match exactly? Revision 1, last verified 2026-11-20T11:43:52Z. https://latestn.com/tool/aider/troubleshooting/flexible-edit-application (accessed 2026-11-21T10:01:11Z). @misc{LatestN_tool_aider_troubleshooting_flexible_edit_application_r1, title = {How does Aider apply edits when the model's diff doesn't match exactly?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/aider/troubleshooting/flexible-edit-application}}, note = {Revision 1; digest sha256:16b7e893db35d855; last verified 2026-11-20T11:43:52Z; accessed 2026-11-21T10:01:11Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/aider/troubleshooting/flexible-edit-application