[BUG] Invalid .claude.json causes OOM

Resolved 💬 6 comments Opened Aug 29, 2025 by blimmer Closed Jan 5, 2026

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 1.0.96 (Claude Code)
  • Operating System: macOS 15.6.1
  • Terminal: iTerm2

Bug Description

When the ~/.claude.json file contains invalid syntax, there are two issues:

  1. Control + C (even many times) does not actually exit the app. It hangs until it eventually OOMs. Here's an example where I reproduce this in a docker container:
root@81bf5cc6efc2:~/code# claude
╭────────────────────────────────────────────────────────────────────╮
│                                                                    │
│ Configuration Error                                                │
│                                                                    │
│ The configuration file at /root/.claude.json contains invalid      │
│ JSON.                                                              │
│                                                                    │
│ Expected double-quoted property name in JSON at position 1819      │
│ (line 57 column 1)                                                 │
│                                                                    │
│ Choose an option:                                                  │
│ ❯ 1. Exit and fix manually                                         │
│   2. Reset with default configuration                              │
│                                                                    │
╰────────────────────────────────────────────────────────────────────╯
Press Ctrl-C again to exit

Claude configuration file at /root/.claude.json is corrupted: Expected double-quoted property name in JSON at position 1819 (line 57 column 1)
^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C
<--- Last few GCs --->

[3951:0xffff88eb0000]   150644 ms: Scavenge 1679.1 (2078.5) -> 1668.0 (2080.7) MB, pooled: 1 MB, 3.06 / 0.00 ms  (average mu = 0.321, current mu = 0.320) allocation failure;
[3951:0xffff88eb0000]   151388 ms: Mark-Compact 1681.5 (2080.7) -> 1652.0 (2070.2) MB, pooled: 12 MB, 714.51 / 0.00 ms  (average mu = 0.318, current mu = 0.314) allocation failure; scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----

 1: 0xdeacc8 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [node]
 2: 0x11814cc v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
 3: 0x118167c v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
 4: 0x13a5f4c  [node]
 5: 0x13a5f7c  [node]
 6: 0x13bd960  [node]
 7: 0x13c054c  [node]
 8: 0x1ba4f94  [node]
Aborted
  1. I've experienced at least once where claude gets stuck in a loop and writes thousands of .claude.json.corrupted.<timestamp> files in $HOME.
 ~  ls -al | grep .claude.json.corrupted | wc -l
    1733
 ~  ls -al | grep .claude.json.corrupted | head -10
-rw-r--r--     1 blimmer staff 11191382 Aug 29 14:05 .claude.json.corrupted.1756497917945
-rw-r--r--     1 blimmer staff 11166857 Aug 29 14:05 .claude.json.corrupted.1756497917980
-rw-r--r--     1 blimmer staff 11166857 Aug 29 14:05 .claude.json.corrupted.1756497918020
-rw-r--r--     1 blimmer staff 11166857 Aug 29 14:05 .claude.json.corrupted.1756497918053
-rw-r--r--     1 blimmer staff 11166857 Aug 29 14:05 .claude.json.corrupted.1756497918087
-rw-r--r--     1 blimmer staff 11166857 Aug 29 14:05 .claude.json.corrupted.1756497918119
-rw-r--r--     1 blimmer staff 11166857 Aug 29 14:05 .claude.json.corrupted.1756497918148
-rw-r--r--     1 blimmer staff 11166857 Aug 29 14:05 .claude.json.corrupted.1756497918183
-rw-r--r--     1 blimmer staff 11166857 Aug 29 14:05 .claude.json.corrupted.1756497918215
-rw-r--r--     1 blimmer staff 11166857 Aug 29 14:05 .claude.json.corrupted.1756497918242

Steps to Reproduce

  1. Make the ~/.claude.json invalid JSON (e.g., echo -n ',' >> ~/.claude.json
  2. Start claude
  3. Press Control+C twice

Expected Behavior

CLI exits without affecting the file

Actual Behavior

CLI hangs until it OOMs. Sometimes it gets stuck in a loop and creates thousands of .claude.json.corrupted.<timestamp> files in $HOME

Additional Context

<!-- Add any other context about the problem here, such as screenshots, logs, etc. -->

View original on GitHub ↗

This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗