Skip to content

[BUG] Grok 4.3 "Unable to apply diff" - Expected '=======' was not found. #186

Closed

Description

@jcalfee

Problem (one or two sentences)

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

  1. Use Grok 4.3 (or similar Grok coder variant) in Zoo Code.
  2. Ask it to make changes to a file via diff.
  3. The model outputs an incomplete diff missing the expected ======= separator.
  4. 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>
Image

Activity

  1. added theissue type on May 18, 2026
  2. proyectoauraorg commented on May 21, 2026

    @proyectoauraorg
    Contributor

    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 🙏

  3. jcalfee commented on May 22, 2026

    @jcalfee
    Author

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions