/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

  1. Have session history with older sessions that were created before session summaries were generated (missing summary field in sessions-index.json entries)
  2. Run /insights
  3. Crash occurs immediately

Evidence

Across multiple project session indexes, many entries are missing the summary key:

  • ___: 53 entries, 53 missing summary
  • ___ project: 43 entries, 22 missing summary
  • ___: 18 entries, 8 missing summary
  • ____: 27 entries, 5 missing summary
  • ___: 4 entries, 3 missing summary
  • _____: 2 entries, 2 missing summary

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

View original on GitHub ↗

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