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

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

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

Fix Action

Fix / Workaround

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

Code Example

TypeError: Object.entries requires that input parameter not be null or undefined
RAW_BUFFERClick to expand / collapse

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).

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING