mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #1704] Marinara sends OpenAI object-form tool_choice that LM Studio rejects (HTTP 400) #846
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#846
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 @aeriondyseti on GitHub (May 31, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1704
Originally assigned to: @cha1latte on GitHub.
Summary
Professor Mari sends
tool_choiceto the LLM provider as a JSON object (themodern OpenAI Chat Completions spec form), but LM Studio's local OpenAI-compatible
server rejects the object form entirely — it only accepts string values
(
"none" | "auto" | "required"). Result: Mari is unusable on LM Studio for any codeor library question (which automatically trigger the forced-tool path).
Surfaced during the Ubuntu re-test of smoke test #1480 (Professor Mari Deeper Pass).
Steps to reproduce
http://localhost:1234/v1).customconnection pointing to LM Studio.question" prompt (e.g. "What does
src/app/shell/AppShell.tsxdo?").Expected behavior
Mari should either:
tool_choicevalue that any OpenAI-API-compatible server accepts (e.g. thestring
"required"), orIn either case the request should complete and Mari should produce a tool-grounded
answer.
Actual behavior
Mari surfaces this in-chat error (no crash — error handling is correct, only the request
shape is the bug):
Wire-level evidence
The actual JSON request body Marinara sent to LM Studio (captured from LM Studio's local
server logs):
The
toolsarray is fine; LM Studio's complaint is specifically and only abouttool_choicebeing an object rather than a string.Code reference
src-tauri/src/commands/storage/mari.rs:191-201:Both branches hardcode the object form. There's no fall-through path that would send
the string form, and no per-provider knowledge that LM Studio only accepts strings.
Suggested fix directions
Pick one:
Send
tool_choice: "required"always. Simplest. Cost: Marinara loses its abilityto force a specific tool — the model picks from the registered tools list. For the
single-tool-registered case this is equivalent. For Mari's 6-tool registry, the system
prompt already guides tool selection strongly enough that this is probably acceptable.
Provider-aware tool_choice. Keep the object form for providers known to support
it (e.g.
openai,openai_chatgpt,openrouter), fall back to"required"forcustomand other less-strict providers. More precise; more code.Spec-compliance fallback. Try the object form first; on HTTP 400 with a
tool_choice-related error, retry once with the string form. Most defensive; adds a
round-trip on failure.
Related pattern
This is the second documented Marinara/LM-Studio interop bug of the same family
(Marinara sends a newer-spec OpenAI request shape; LM Studio rejects it):
response_format.typerejected by LM Studio.tool_choiceobject form rejected by LM Studio.A more general fix might be to maintain a per-provider capability table (which OpenAI
extensions each
custom-like server supports) rather than patching each parameterindividually.
Environment
refactor@5ea8a10cpnpm tauri dev)recoverable — the updated build crashed at startup with SIGTRAP shortly after,
separate problem; the wire-level evidence above was captured from the previous
working LM Studio version which also rejected the object form, so this is not version
specific)
qwen3.5-27b-heretic-i1(uncensoring finetune — modelcapability is a separate concern; this bug surfaces before the model sees the request
at all)
Related
@aeriondyseti commented on GitHub (May 31, 2026):
Corroboration:
tool_choiceobject form works fine with OllamaContinuing the smoke test that surfaced this issue, switched the Marinara
customconnection to point at Ollama (
http://localhost:11434/v1) without changing anyMarinara code. The exact same
tool_choiceobject form that LM Studio rejectedwith HTTP 400 is accepted by Ollama for tool-capable models (verified with
qwen2.5:7b-instructandqwen3:8b), and Mari's ReAct loop completed end-to-end —multiple tool calls observed in
journalctl -u ollamaper user message, no protocolerrors.
This isolates the bug as LM-Studio-specific, not a Marinara/wider compatibility
break. Marinara is sending OpenAI-spec-compliant requests; LM Studio is implementing
a narrower-than-spec
tool_choicesubset.(Bonus data point: Ollama also gates capabilities by model — switching the same
connection's model to
deepseek-r1:14breturned a cleanregistry.ollama.ai/library/deepseek-r1:14b does not support toolserror, surfacedsafely in Mari's chat. Demonstrates the right pattern for
custom-protocol serversto reject tool requests for models that can't handle them — something LM Studio could
adopt.)
@cha1latte commented on GitHub (May 31, 2026):
Fixed in #1740