/insights crashes with TypeError when session entries lack summary field
Resolved 💬 4 comments Opened Feb 7, 2026 by Lucas-Trunks Closed Mar 8, 2026
Bug Description
Running /insights crashes with:
TypeError: undefined is not an object (evaluating 'Object.keys(b)')
Root Cause
Session index files (sessions-index.json) in ~/.claude/projects/*/ contain entries that are missing the summary key. The /insights command does not handle this case and crashes when it tries to operate on the undefined value.
Reproduction
- Have session history with older sessions that were created before session summaries were generated (missing
summaryfield insessions-index.jsonentries) - Run
/insights - Crash occurs immediately
Evidence
Across multiple project session indexes, many entries are missing the summary key:
___: 53 entries, 53 missingsummary___project: 43 entries, 22 missingsummary___: 18 entries, 8 missingsummary____: 27 entries, 5 missingsummary___: 4 entries, 3 missingsummary_____: 2 entries, 2 missingsummary
All other fields (sessionId, messageCount, created, modified, etc.) are present — only summary is missing on older sessions.
Expected Behavior
/insights should gracefully handle session entries that lack a summary field (skip them or treat as empty string) rather than crashing.
Environment
- Platform: macOS (Darwin 24.1.0)
- Claude Code: Latest version via Homebrew
- Multiple projects with mixed old/new session entries
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗