mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #592] serve: a malformed "tools" value kills the request thread (connection reset / 502 instead of a 400) #278
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#278
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @MingShi350 on GitHub (Oct 3, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/592
What happens. A request whose
toolsis not a list of tool objects takes the request thread down with anAttributeError. The connection closes with no reply at all — the same request through a reverse proxy shows as502. A400naming the bad field would be right.Seen on Windows, Strata 0.1.38, engine IQ3_XXS, 128K context, OpenAI endpoint, client on another PC.
Where. Two places, one line apart (both still on
main):serve/frontend.py:185— an entry that is not{"type": "function", ...}is handed on unchanged:serve/server.py:2422— the next consumer assumes every entry is a mapping:Traceback (the server's own console):
Reproduce. Any of these:
Expected:
400saying what is wrong withtools.Observed: no reply; the traceback above; the server itself stays up and the next request is answered normally.
The Anthropic path is the same shape, one line up at
serve/frontend.py:235, wheret["name"]on a stringraises
TypeError: string indices must be integersfor the same kind of input.Suggested fix. Refuse a malformed
toolswhere the request is parsed —openai_to_messages/anthropic_to_messagesalready raiseValueErrorfor other fields, and the caller turns that into a400— andguard the consumer as a second line of defence:
I hit this from a client that put the wrong value in
toolsby mistake; the connection reset made it look like theengine had died, so the clean
400would have saved some hunting.@Niko1221 commented on GitHub (Oct 4, 2026):
Fixed in 0.1.39: a
toolsvalue that is not a list of named tool objects (a string such as "auto", a list of names, an object without a name) now gets a 400 that says whattoolsmust look like, on /v1/chat/completions and /v1/messages, instead of a dropped connection. A JSON-string list is decoded, as formessages, and the bare{"name": ...}shape is still accepted on the OpenAI path. Thanks for the precise report and the three curl cases, which are now tests.