You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Grok 4.3 "Unable to apply diff" - Expected '=======' was not found. #186
Grok 4.3 frequently generates malformed or truncated diffs that fail to apply in Zoo Code, producing the error: "Unable to apply diff to file: ... ERROR: Unexpected end of sequence: Expected '=======' was not found."
Context (who is affected and when)
Affects users editing files with Grok 4.3 in Zoo Code's diff/edit mode. Happens during normal code editing tasks.
Reproduction steps
Use Grok 4.3 (or similar Grok coder variant) in Zoo Code.
Ask it to make changes to a file via diff.
The model outputs an incomplete diff missing the expected ======= separator.
Zoo Code's apply_diff tool fails with the exact error shown in the attached screenshot.
Expected result
The diff should apply cleanly, or Zoo Code should gracefully handle/fallback on malformed output from the model.
Actual result
Edit fails with "Unable to apply diff" and the sequence error.
Variations tried (optional)
Retrying the same prompt (sometimes succeeds, often fails again).
More explicit prompts asking for clean unified diffs.
App Version
v3.54.1
API Provider
xAI / Grok
Model Used
Grok 4.3
Zoo Code Task Links (optional)
(none)
Relevant logs or errors (optional)
Unable to apply diff to file: /home/user/dev/ipall/apps/backup/ipfs-backup/lib/common.sh
<error_details>
ERROR: Unexpected end of sequence: Expected '=======' was not found.
</error_details>
Opened #230 to address this. Grok truncates the streamed diff so the block arrives without its ======= / >>>>>>> REPLACE markers, which is what triggers the "Expected '=======' was not found" error. The PR adds a repairTruncatedDiff() recovery step that reinserts the missing markers (leaving complete, well-formed diffs untouched). Feedback welcome 🙏
This may have been grok-code-fast.. I believe they took that model offline and re-directed to their more expensive model x-ai/grok-4.3 .. I have switched the new deepseek model instead so I have not seen this error since. If that model messed up the diff, it is the model that needs to be fixed not Zoo Code. Also, like I said, this may no longer be an issue.
Activity
proyectoauraorg commentedon May 21, 2026
Opened #230 to address this. Grok truncates the streamed diff so the block arrives without its
=======/>>>>>>> REPLACEmarkers, which is what triggers the "Expected '=======' was not found" error. The PR adds arepairTruncatedDiff()recovery step that reinserts the missing markers (leaving complete, well-formed diffs untouched). Feedback welcome 🙏fix(diff): repair truncated Grok diffs by reinserting missing markers (…
test(diff): add fixture-based regression tests for truncated Grok dif…
refactor(diff): address CodeRabbit review on truncated-diff repair (Z…
jcalfee commentedon May 22, 2026
This may have been grok-code-fast.. I believe they took that model offline and re-directed to their more expensive model x-ai/grok-4.3 .. I have switched the new deepseek model instead so I have not seen this error since. If that model messed up the diff, it is the model that needs to be fixed not Zoo Code. Also, like I said, this may no longer be an issue.
fix(diff): repair truncated Grok diffs by reinserting missing markers (…
test(diff): add fixture-based regression tests for truncated Grok dif…
refactor(diff): address CodeRabbit review on truncated-diff repair (Z…
fix(diff): repair truncated Grok diffs with missing markers (Zoo-Code…