Fix crash when tool_use input is a list instead of dict

Some Claude Code JSONL transcripts have tool_use blocks where the
`input` field is a list rather than a dict (e.g. multi-content tool
calls). This causes an AttributeError on line 554 when code tries to
call `.get()` on the list.

Guard by normalizing list inputs to an empty dict, allowing mining
to proceed without losing other tool metadata.

Fixes: mining Claude Code conversations crashes with
  AttributeError: 'list' object has no attribute 'get'
  at normalize.py:554
This commit is contained in:
robertcprice
2026-06-03 20:29:48 -04:00
parent 02b8753d97
commit 5ba8399bb2
+2
View File
@@ -523,6 +523,8 @@ def _format_tool_use(block: dict) -> str:
"""Format a tool_use block into a human-readable one-liner."""
name = block.get("name", "Unknown")
inp = block.get("input", {})
if isinstance(inp, list):
inp = {}
if name == "Bash":
cmd = inp.get("command", "")