Invalid Version error on startup: changelog cache contains non-semver version string

Resolved 💬 5 comments Opened Jan 7, 2026 by HF-teamdev Closed Feb 21, 2026

Bug Description

Claude Code 2.1.0 fails to start with a semver parsing error when the changelog cache file contains a version header with a date suffix.

Error Message

ERROR  Invalid Version: 2.1.0 (2026-01-07)

TypeError: Invalid Version: 2.1.0 (2026-01-07)
    at new SemVer (/snapshot/cli/node_modules/semver/classes/semver.js:79:13)
    at compare (/snapshot/cli/node_modules/semver/functions/compare.js:4:10)
    at greaterThan (/snapshot/cli/node_modules/semver/functions/gt.js:3:10)
    at /snapshot/cli/dist/entrypoints/cli.js:1:313766
    ... (stack trace continues)

Root Cause

The cached changelog file at ~/.claude/cache/changelog.md contains markdown headers in the format:

## 2.1.0 (2026-01-07)

The changelog parsing logic appears to extract the full header text 2.1.0 (2026-01-07) and pass it to semver for comparison, but this format is not valid semver (the date in parentheses breaks parsing).

Steps to Reproduce

  1. Have Claude Code 2.1.0 installed
  2. Allow the changelog cache to be populated (happens automatically)
  3. Open a new terminal and run claude
  4. Observe the "Invalid Version" error

Impact

  • Severity: High - Completely blocks Claude Code from starting
  • Affected users: Multiple users confirmed (at least 3 separate codespace environments)
  • Workaround available: Yes (see below)

Workaround

Delete the changelog cache file:

rm -f ~/.claude/cache/changelog.md && claude

This allows Claude Code to start. The cache will be regenerated, but the issue may recur after an update.

Expected Behavior

The changelog parsing should extract only the semver-compliant portion of the version string (e.g., 2.1.0) before passing it to semver validation functions, ignoring any trailing content like dates in parentheses.

Suggested Fix

When parsing changelog headers, use a regex to extract just the version number:

// Instead of using the full header text
const versionMatch = headerText.match(/^(\d+\.\d+\.\d+)/);
const version = versionMatch ? versionMatch[1] : headerText;

Environment

  • Claude Code Version: 2.1.0
  • Platform: Linux (GitHub Codespaces)
  • OS: Ubuntu (Linux 6.8.0-1030-azure)
  • Installation: Native binary (Bun-compiled)
  • Shell: Bash

Additional Context

  • The issue affects fresh terminal sessions even when one Claude Code instance is already running
  • The changelog cache is located at ~/.claude/cache/changelog.md
  • The binary is located at ~/.local/share/claude/versions/2.1.0
  • claude --version returns 2.1.0 (Claude Code) which works fine - the issue is specifically with changelog version comparison

---

🤖 This issue was documented with assistance from Claude Code

View original on GitHub ↗

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