Bug: CLI crashes on startup due to semver parsing of changelog dates
Status Closed — not planned
Maintainer reply None cached
Workaround ✓ Mentioned in description ↑
Activity 2 comments · opened Jan 7, 2026 · closed Jan 7, 2026
Description
Claude Code CLI crashes on startup with Invalid Version error when the changelog cache contains version headers with dates in parentheses.
Error
ERROR Invalid Version: 2.1.0 (2026-01-07)
file:///.../@anthropic-ai/claude-code/cli.js:869:8900
- iT (file:///.../cli.js:869:8900)
- SJ8 (file:///.../cli.js:869:14028)
- Object.dJ8 (file:///.../cli.js:869:14584)
- (file:///.../cli.js:3091:4240)
at Array.sort (<anonymous>)
- de2 (file:///.../cli.js:3091:4224)
Root Cause
The file ~/.claude/cache/changelog.md contains version headers in the format:
## 2.1.0 (2026-01-07)
The CLI's semver parser expects strict semver format (2.1.0) but receives 2.1.0 (2026-01-07) which includes the release date. This causes the parser to fail during version comparison/sorting.
Workaround
Strip date suffixes from version headers:
sed -i '' 's/## \([0-9]*\.[0-9]*\.[0-9]*\) ([^)]*)/## \1/g' ~/.claude/cache/changelog.md
Suggested Fix
When parsing changelog versions, strip or ignore the date portion in parentheses before passing to semver parser:
// Before parsing
const versionMatch = line.match(/^## (\d+\.\d+\.\d+)/);
const version = versionMatch ? versionMatch[1] : null;
Environment
- Node.js: v22.16.0
- OS: macOS (Darwin)
- Claude Code: 2.1.0
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗