Skip to content

Fix telemetry hook crash on string toolUseResult - #174

Merged
fcakyon merged 1 commit into
mainfrom
fix/telemetry-string-toolresult
Apr 26, 2026
Merged

Fix telemetry hook crash on string toolUseResult#174
fcakyon merged 1 commit into
mainfrom
fix/telemetry-string-toolresult

Conversation

@fcakyon

@fcakyon fcakyon commented Apr 26, 2026

Copy link
Copy Markdown
Owner

The claude-telemetry-hooks UserPromptSubmit hook chained .get on entry["toolUseResult"], which Claude Code stores as a plain string (e.g. "User rejected tool use", "Error: EPERM ...") for rejected/errored tools. A type-guard with isinstance(..., dict) fixes 40 of 138 real transcripts that previously crashed and recovers reject telemetry on 37 of them. Bumps the plugin to 1.0.1.

Before: entry.get("toolUseResult", {}).get("interrupted")AttributeError: 'str' object has no attribute 'get'
After: tur = tur if isinstance(tur, dict) else {} then tur.get("interrupted")

The UserPromptSubmit hook chained .get on entry["toolUseResult"], which is a string for rejected/errored tools. Type-guard with isinstance(..., dict) fixes 40 of 138 real transcripts that previously crashed and recovers reject telemetry on 37 of them.
@fcakyon fcakyon self-assigned this Apr 26, 2026
@fcakyon
fcakyon merged commit c718f4f into main Apr 26, 2026
1 check passed
@fcakyon
fcakyon deleted the fix/telemetry-string-toolresult branch April 26, 2026 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant