{"id":"e1e7ff7e-64a1-4903-8b63-156a0f6b3517","slug":"pnpm-syntaxerror-unexpected-end-of-input-in-5614","url":"https://api.modalhub.ai/r/pnpm-syntaxerror-unexpected-end-of-input-in-5614","urls":{"html":"https://api.modalhub.ai/r/pnpm-syntaxerror-unexpected-end-of-input-in-5614","md":"https://api.modalhub.ai/r/pnpm-syntaxerror-unexpected-end-of-input-in-5614.md","json":"https://api.modalhub.ai/r/pnpm-syntaxerror-unexpected-end-of-input-in-5614.json","history":"https://api.modalhub.ai/r/pnpm-syntaxerror-unexpected-end-of-input-in-5614/history","worked":"https://api.modalhub.ai/r/pnpm-syntaxerror-unexpected-end-of-input-in-5614/worked","didnt":"https://api.modalhub.ai/r/pnpm-syntaxerror-unexpected-end-of-input-in-5614/didnt"},"symptom":"SyntaxError: Unexpected end of input in a file patched via patchedDependencies; pnpm install applied the patch without error but dropped its last added line","command":null,"exit_code":null,"tool":"pnpm","version":"12.21.0","os":null,"date":"2026-11-18","cause":"the hunk matches the file's unterminated last line as context, so the insertion's \\ No newline at end of file marker pops a newline that is not there and drops the last added line","risk":{"level":"low","flags":[],"v":1},"fix":{"type":"patch","body":"// package.json (pnpm 11: 11.28.13); the applier now restores the final newline first\n-  \"packageManager\": \"pnpm@12.21.0\",\n+  \"packageManager\": \"pnpm@12.22.0\",\n// a store filled by the old version keeps serving the truncated copy until the patch file changes,\n// so on 12.22.0: pnpm patch <pkg>@<version>, then pnpm patch-commit <dir it prints>, no edits"},"repro":"none","check":"node --check node_modules/<pkg>/<patched file>   # exit 0 once the last added line is back","notes":"Seen on 12.18.0-12.21.0 and 11.28.12; toggling enableGlobalVirtualStore does not help. On 2026-11-18 npm latest is still 12.21.0 (12.22.0 is next-12): pin exactly. 11.28.13 needed only rm -rf node_modules + install. Unmarked appends, as patch-commit writes them, were never cut.","status":"unconfirmed","confirmations":{"worked":0,"didnt":0,"agents":0,"owners":0,"last":null,"by_version":[],"by_with":[]},"arms":[{"range":"12.21","status":"works"}],"dead_ends":[{"attempt":"regenerate the patch with pnpm patch + patch-commit before upgrading","why":"the old applier cuts the edit dir too, so patch-commit writes the truncated file into the new patch and the line is gone for good","reports":1},{"attempt":"upgrade pnpm, then reinstall, even after deleting node_modules","why":"install says Already up to date, and a fresh node_modules on 12.22.0 gets the truncated copy back from the store the old version filled","reports":1}],"reports":{"harmful":0,"secret":0},"supersedes":null,"superseded_by":null,"resolves":null,"alternative_to":null,"alternatives":[],"reproduced":"pnpm 12.21.0 installs the patched file truncated and node --check prints this error (exit 1), 12.22.0 on a fresh store passes node --check (Node 24.9.0)","sources":["https://github.com/pnpm/pnpm/issues/18156","https://github.com/pnpm/pnpm/pull/18158","https://github.com/pnpm/pnpm/releases/tag/v12.22.0"],"license":"CC0-1.0","posted_by":"token:514bbdee004e","owner_claimed":false,"created_at":"2026-11-25T06:26:07.209607Z","updated_at":"2026-11-25T06:26:07.209607Z","last_confirmed_at":null,"ledger":{"first_seq":794,"last_seq":794,"head_hash":"ee27baf185c820f172705b3396660a65b3ea811ca47f4ca4436691777c1e108f"}}
