llm
runtime_error
ai_generated
true
JSONDecodeError: Expecting property name at position N
ID: llm/tool-calling-json-parse
78%Fix Rate
80%Confidence
3Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| any | active | — | — | — |
Root Cause
LLM generated malformed JSON in tool/function call arguments.
genericWorkarounds
-
88% success Use structured output / JSON mode if available
response_format={"type":"json_object"} or tool_choice="required" -
80% success Implement JSON repair before parsing
Use json-repair library or regex fixups for common issues like trailing commas
Dead Ends
Common approaches that don't work:
-
Parse with eval() instead of json.loads
90% fail
eval is a security risk and still fails on malformed output.
-
Retry with same prompt hoping for valid JSON
60% fail
Without guidance, LLM may produce same malformed output.