Skip to content

fix: Handle invalid JSON in tool calls for anthropic provider#1741

Merged
tusharmath merged 2 commits intomainfrom
anthropic-input
Oct 16, 2025
Merged

fix: Handle invalid JSON in tool calls for anthropic provider#1741
tusharmath merged 2 commits intomainfrom
anthropic-input

Conversation

@tusharmath
Copy link
Copy Markdown
Collaborator

@tusharmath tusharmath commented Oct 16, 2025

On anthropic provider, when we send the raw unparsed invalid json string, the provider fails with an error -

Caused by:
    0: 400 Bad Request Reason: {"type":"error","error":{"type":"invalid_request_error","message":"messages.142.content.1.tool_use.input: Input should be a valid dictionary"},"request_id":"req_011CUAtSJTMWRaDS5AYpR2kM"}
    


This PR solves the problem by dropping such tool call requests

Screenshot 2025-10-16 at 7 05 38 PM

@github-actions github-actions Bot added the type: feature Brand new functionality, features, pages, workflows, endpoints, etc. label Oct 16, 2025
@tusharmath tusharmath changed the title feat: implement DropInvalidToolUse transformer to filter invalid tool calls fix: Handle invalid JSON in tool calls for anthropic provider Oct 16, 2025
@github-actions github-actions Bot added the type: fix Iterations on existing features or infrastructure. label Oct 16, 2025
@tusharmath tusharmath enabled auto-merge (squash) October 16, 2025 17:33
@tusharmath tusharmath merged commit 7183e97 into main Oct 16, 2025
9 checks passed
@tusharmath tusharmath deleted the anthropic-input branch October 16, 2025 17:34
@amitksingh1490 amitksingh1490 removed the type: feature Brand new functionality, features, pages, workflows, endpoints, etc. label Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix Iterations on existing features or infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants