[Bug] Marketplace config JSON parsing hangs on empty files without error handling - cannot start claude when this happens
Bug Description
Whenever a marketplaces.json or known_marketplaces.json is empty (not even {} ) - it causes claude to hang while trying to load with no error. the indication for that is when trying to reinstall you get this error: Setting up Claude Code...
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error: Failed to load marketplace configuration: JSON Parse error: Unexpected EOF
at y8 (/$bunfs/root/claude:144:60790)
at y8 (/$bunfs/root/claude:144:60795)
at v68 (/$bunfs/root/claude:4566:5497)
at v68 (/$bunfs/root/claude:4566:6068)
at
Environment Info
- Platform: darwin
- Terminal: cursor
- Version: 2.1.9
- Feedback ID: 5951c4fb-1fb7-4733-8fd2-a1cc2b497793
Errors
[{"error":"Error: Failed to fetch version from https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/latest: timeout of 30000ms exceeded\n at yo7 (/$bunfs/root/claude:3353:2087)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-17T18:19:30.487Z"},{"error":"Error: {\"message\":\"Operation timed out.\",\"originalLine\":\"685\",\"originalColumn\":\"107215\",\"line\":\"685\",\"column\":\"107215\",\"sourceURL\":\"/$bunfs/root/claude\",\"stack\":\"Error: Operation timed out.\\n at <anonymous> (/$bunfs/root/claude:685:107215)\",\"name\":\"Error\"}\n at error (/$bunfs/root/claude:2354:25029)\n at <anonymous> (/$bunfs/root/claude:685:36350)\n at tVD (/$bunfs/root/claude:685:36894)\n at <anonymous> (/$bunfs/root/claude:686:16930)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-17T18:19:30.489Z"},{"error":"Error: 1P event logging: 3 events failed to export\n at queueFailedEvents (/$bunfs/root/claude:691:2081)\n at async doExport (/$bunfs/root/claude:691:1259)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-17T18:19:30.582Z"},{"error":"Error: {\"message\":\"Failed to export 3 events\",\"originalLine\":\"691\",\"originalColumn\":\"1338\",\"line\":\"691\",\"column\":\"1338\",\"sourceURL\":\"/$bunfs/root/claude\",\"stack\":\"Error: Failed to export 3 events\\n at doExport (/$bunfs/root/claude:691:1338)\\n at processTicksAndRejections (native:7:39)\",\"name\":\"Error\"}\n at error (/$bunfs/root/claude:2354:25029)\n at <anonymous> (/$bunfs/root/claude:685:36350)\n at tVD (/$bunfs/root/claude:685:36894)\n at <anonymous> (/$bunfs/root/claude:686:17366)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-17T18:19:30.582Z"},{"error":"Error: 1P event logging: 7 events failed to export\n at queueFailedEvents (/$bunfs/root/claude:691:2081)\n at async doExport (/$bunfs/root/claude:691:1259)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-17T18:33:37.559Z"},{"error":"Error: {\"message\":\"Failed to export 7 events\",\"originalLine\":\"691\",\"originalColumn\":\"1338\",\"line\":\"691\",\"column\":\"1338\",\"sourceURL\":\"/$bunfs/root/claude\",\"stack\":\"Error: Failed to export 7 events\\n at doExport (/$bunfs/root/claude:691:1338)\\n at processTicksAndRejections (native:7:39)\",\"name\":\"Error\"}\n at error (/$bunfs/root/claude:2354:25029)\n at <anonymous> (/$bunfs/root/claude:685:36350)\n at tVD (/$bunfs/root/claude:685:36894)\n at <anonymous> (/$bunfs/root/claude:686:17366)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-17T1
Note: Error logs were truncated.
Found 3 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/14360
- https://github.com/anthropics/claude-code/issues/14477
- https://github.com/anthropics/claude-code/issues/2810
This issue will be automatically closed as a duplicate in 3 days.
- If your issue is a duplicate, please close it and 👍 the existing issue instead
- To prevent auto-closure, add a comment or 👎 this comment
🤖 Generated with Claude Code
Its not duplicate, this is different issue. Resolving when deleting the .claude\plugins\known_marketplaces.json
And notably claude on crashing can itself cause this corruption to the known_marketplaces.json because it uses a non-atomic write when writing to it, e.g.,
X = openSync(path, "w");
writeSync(X, content);
fsyncSync(X);
closeSync(X);
The openSync with mode "w" truncates the file to 0 bytes, if the process dies at that point, we get a 0-byte file