fix(anthropic): skip tool calls with empty names to prevent API errors (#1658)#1739
Merged
yinwm merged 1 commit intosipeed:mainfrom Mar 18, 2026
Merged
Conversation
When building parameters for Anthropic API calls, tool calls with empty names would cause 400 Bad Request errors with the message: 'tool_use.name: String should have at least 1 character' This fix adds a check to skip tool calls that have empty names, preventing the API error and allowing the conversation to continue normally. Fixes sipeed#1658
afjcjsbx
approved these changes
Mar 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes issue #1658 where Anthropic API returns 400 Bad Request error when tool calls have empty names.
Problem
When messaging PicoClaw with Claude models, users consistently get this error:
Root Cause
When building parameters for Anthropic API calls in
buildParams(), tool calls with empty names were being passed directly to the API, which rejects them.Solution
Added a simple check to skip tool calls that have empty names before constructing the API request. This prevents the API error and allows the conversation to continue normally.
Type of Change
AI Code Generation
Related Issue
Fixes #1658
Technical Context
Similar fix was implemented in OpenClaw: openclaw/openclaw@aa56045
Test Environment
Checklist