opentui: fatal: Added line count did not match for hunk at line 23 #2540

Closed
opened 2026-02-16 17:36:08 -05:00 by yindo · 1 comment
Owner

Originally created by @jad-haddad on GitHub (Nov 3, 2025).

Description

Error: Added line count did not match for hunk at line 23
    at parseHunk (../../node_modules/.bun/diff@8.0.2/node_modules/diff/libesm/patch/parse.js:119:23)
    at parseIndex (../../node_modules/.bun/diff@8.0.2/node_modules/diff/libesm/patch/parse.js:38:34)
    at parsePatch (../../node_modules/.bun/diff@8.0.2/node_modules/diff/libesm/patch/parse.js:127:9)
    at <anonymous> (src/cli/cmd/tui/routes/session/index.tsx:387:23)
    at <anonymous> (src/cli/cmd/tui/routes/session/index.tsx:396:8)
    at runComputation (../../node_modules/.bun/solid-js@1.9.9/node_modules/solid-js/dist/dev.js:742:22)
    at updateComputation (../../node_modules/.bun/solid-js@1.9.9/node_modules/solid-js/dist/dev.js:724:3)
    at runTop (../../node_modules/.bun/solid-js@1.9.9/node_modules/solid-js/dist/dev.js:833:7)
    at runQueue (../../node_modules/.bun/solid-js@1.9.9/node_modules/solid-js/dist/dev.js:904:42)
    at completeUpdates (../../node_modules/.bun/solid-js@1.9.9/node_modules/solid-js/dist/dev.js:860:84)
    at runUpdates (../../node_modules/.bun/solid-js@1.9.9/node_modules/solid-js/dist/dev.js:850:5)
    at setStore (../../node_modules/.bun/solid-js@1.9.9/node_modules/solid-js/store/dist/dev.js:221:5)
    at <anonymous> (src/cli/cmd/tui/context/sync.tsx:73:13)
    at emit (../../node_modules/.bun/@solid-primitives+event-bus@1.1.2+820208fac86deffb/node_modules/@solid-primitives/event-bus/dist/eventBus.js:6:13)
    at emit (../../node_modules/.bun/@solid-primitives+event-bus@1.1.2+820208fac86deffb/node_modules/@solid-primitives/event-bus/dist/emitter.js:92:20)
    at <anonymous> (src/cli/cmd/tui/context/sdk.tsx:25:17)
    at processTicksAndRejections (native:7:39)...

OpenCode version

1.0.15

Steps to reproduce

I prompted the build agent multiple time to fix an issue, and so it did many different modifications, as I was unpleased with the end result, I started undo-ing the changed, multiple times to go back to the initial state, after about 4 undos, I got this error

Screenshot and/or share link

No response

Operating System

macOS 15.7.1

Terminal

iTerm2

Originally created by @jad-haddad on GitHub (Nov 3, 2025). ### Description ``` Error: Added line count did not match for hunk at line 23 at parseHunk (../../node_modules/.bun/diff@8.0.2/node_modules/diff/libesm/patch/parse.js:119:23) at parseIndex (../../node_modules/.bun/diff@8.0.2/node_modules/diff/libesm/patch/parse.js:38:34) at parsePatch (../../node_modules/.bun/diff@8.0.2/node_modules/diff/libesm/patch/parse.js:127:9) at <anonymous> (src/cli/cmd/tui/routes/session/index.tsx:387:23) at <anonymous> (src/cli/cmd/tui/routes/session/index.tsx:396:8) at runComputation (../../node_modules/.bun/solid-js@1.9.9/node_modules/solid-js/dist/dev.js:742:22) at updateComputation (../../node_modules/.bun/solid-js@1.9.9/node_modules/solid-js/dist/dev.js:724:3) at runTop (../../node_modules/.bun/solid-js@1.9.9/node_modules/solid-js/dist/dev.js:833:7) at runQueue (../../node_modules/.bun/solid-js@1.9.9/node_modules/solid-js/dist/dev.js:904:42) at completeUpdates (../../node_modules/.bun/solid-js@1.9.9/node_modules/solid-js/dist/dev.js:860:84) at runUpdates (../../node_modules/.bun/solid-js@1.9.9/node_modules/solid-js/dist/dev.js:850:5) at setStore (../../node_modules/.bun/solid-js@1.9.9/node_modules/solid-js/store/dist/dev.js:221:5) at <anonymous> (src/cli/cmd/tui/context/sync.tsx:73:13) at emit (../../node_modules/.bun/@solid-primitives+event-bus@1.1.2+820208fac86deffb/node_modules/@solid-primitives/event-bus/dist/eventBus.js:6:13) at emit (../../node_modules/.bun/@solid-primitives+event-bus@1.1.2+820208fac86deffb/node_modules/@solid-primitives/event-bus/dist/emitter.js:92:20) at <anonymous> (src/cli/cmd/tui/context/sdk.tsx:25:17) at processTicksAndRejections (native:7:39)... ``` ### OpenCode version 1.0.15 ### Steps to reproduce I prompted the build agent multiple time to fix an issue, and so it did many different modifications, as I was unpleased with the end result, I started undo-ing the changed, multiple times to go back to the initial state, after about 4 undos, I got this error ### Screenshot and/or share link _No response_ ### Operating System macOS 15.7.1 ### Terminal iTerm2
yindo added the opentuibug labels 2026-02-16 17:36:08 -05:00
yindo closed this issue 2026-02-16 17:36:09 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Nov 3, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #3700: Same error "Added line count did not match for hunk at line 76" - triggered by /undo after tool_use/tool_result error
  • #3818: Same error "Added line count did not match for hunk at line 14" - similar diff parsing issue
  • #3812: Same error "Added line count did not match for hunk at line 43" - same diff parsing failure (closed)

All appear to be the same underlying issue with diff/patch parsing in the opentui implementation when using undo functionality after multiple modifications.

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Nov 3, 2025): This issue might be a duplicate of existing issues. Please check: - #3700: Same error "Added line count did not match for hunk at line 76" - triggered by /undo after tool_use/tool_result error - #3818: Same error "Added line count did not match for hunk at line 14" - similar diff parsing issue - #3812: Same error "Added line count did not match for hunk at line 43" - same diff parsing failure (closed) All appear to be the same underlying issue with diff/patch parsing in the opentui implementation when using undo functionality after multiple modifications. Feel free to ignore if none of these address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2540