[BUG] Claude Code crashes on startup with TypeError: Cannot read properties of null (reading 'history') when .claude.json contains project entries with null array fields
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
The symptom is claude code desktop is unresponsive when prompting even in new sessions, for Claude Code CLI the issue was mitigated by doing a rollback to an older version
Version: 2.1.170 (desktop bundled), 2.1.161 (npm)
Platform: Windows 11
Error: TypeError: Cannot read properties of null (reading 'history') at g1B in cli.js:242
Root cause: g1B migration function iterates Object.entries(projects) but doesn't null-check individual project values before accessing .history
Reproduction: Have a .claude.json with project entries containing null array fields (allowedTools, mcpContextUris, etc.) from an older version, then upgrade to 2.1.x
What Should Happen?
It should respond
Error Messages/Logs
TypeError: Cannot read properties of null (reading 'history')
at g1B (cli.js:242:2112)
at m0 (cli.js:242:1513)
at cg (cli.js:256:1670)
Steps to Reproduce
- Create ~/.claude/.claude.json with this content:
{
"projects": {
"C:\\any\\path": {
"allowedTools": null,
"mcpContextUris": null,
"enabledMcpjsonServers": null,
"disabledMcpjsonServers": null,
"hasTrustDialogAccepted": true
}
}
}
- Run claude
- Observe crash with TypeError: Cannot read properties of null (reading 'history')
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.0.0
Claude Code Version
2.1.173 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
<img width="1911" height="1072" alt="Image" src="https://github.com/user-attachments/assets/bc66f6d0-5a0b-4451-9e59-74956c791d6f" />
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗