[BUG] /insights: TypeError on Object.entries when session-meta files have lean shape (repro on v2.1.143, ref #35394)

Resolved 💬 1 comment Opened May 17, 2026 by alibrohde Closed May 21, 2026

Filing fresh per the stale-bot closing message on #35394, which is locked.

Version: Claude Code 2.1.143, macOS 15 (Darwin 24.6.0) arm64.

Error:

TypeError: Object.entries requires that input parameter not be null or undefined

Trigger: /insights crashes when any file under ~/.claude/usage-data/session-meta/ is in the original "lean" shape (only session_id, start_time, end_time, input_tokens, output_tokens, cache_*, cwd, transcript_path) and missing the enriched dict fields tool_counts, languages, tool_error_categories.

Repro on a fresh session-meta dir:

  1. Pick a session-meta file and remove tool_counts, languages, tool_error_categories from the JSON.
  2. Run /insights.
  3. Observe the TypeError.

Workaround: Padding missing fields with {} (i.e. "tool_counts": {}, "languages": {}, "tool_error_categories": {}) in affected session-meta files restored /insights output.

Likely fix: Object.entries(session.tool_counts ?? {}) (and same for languages / tool_error_categories) wherever the report builder iterates these fields. A lean session-meta file is a valid intermediate state, so the consumer should default-empty rather than crash.

Same error class as #35394 (closed NOT_PLANNED by stale-bot, not fixed).

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗