[BUG] /insights: TypeError on Object.entries when session-meta files have lean shape (repro on v2.1.143, ref #35394)
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:
- Pick a session-meta file and remove
tool_counts,languages,tool_error_categoriesfrom the JSON. - Run
/insights. - 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).
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗