[BUG] Azure json.loads TypeError on dict or null tool arguments
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 58.8k
- Forks
- 8.5k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 109
Description
Description
Azure completion parses tool arguments with json.loads and only catches JSONDecodeError. Already-parsed dicts and JSON null raise TypeError and abort the call. OpenAI's native provider already guards string vs dict.
Steps to Reproduce
Streamed or replayed Azure tool calls can carry arguments as a dict or as None. json.loads(None) and json.loads({"city": "London"}) both raise TypeError.
Expected behavior
A dict is used as-is. None or blank strings become {}. Invalid JSON is logged and skipped, matching the current JSONDecodeError path.
Screenshots/Code snippets
TypeError: the JSON object must be str, bytes or bytearray, not dict
Operating System
Windows 11
Python Version
3.12
crewAI Version
main
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Azure completion tool-argument parsing path and reproduce streamed or replayed calls with dict, None, blank-string, and invalid JSON arguments. The fix is done when dicts pass through, None or blank strings yield {}, and invalid JSON follows the existing logged-and-skipped behavior without aborting the call.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ai, backend-api-design
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100