Skip to content

fix: resolve 400 Bad Request on tool calls with null content - #1

Open
andomeder wants to merge 2 commits into
bermudi:mainfrom
andomeder:fix-null-content-tool-calls
Open

fix: resolve 400 Bad Request on tool calls with null content#1
andomeder wants to merge 2 commits into
bermudi:mainfrom
andomeder:fix-null-content-tool-calls

Conversation

@andomeder

Copy link
Copy Markdown

Fixes an issue where models generating tool calls (like xiaomi/mimo-v2.5-pro) send content: null while thinking/acting.

Previously, the proxy passed this nil value through, causing the JSON marshaler to output null. CommandCode's API strictly expects an array or string, resulting in a 400 Bad Request: expected array, received null.

Changes Made

  • Patched BuildCCRequestWithWorkingDir in internal/proxy/proxy.go.
  • Explicitly initialized []api.CCContentPart{} when the incoming message content is nil.

This ensures the JSON marshaler outputs an empty array [] instead of null, satisfying the upstream schema validation while preserving the tool call data.

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