mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #7457] [Issue]: Strict Mistral-family chat templates (Rocinante et al.) reject requests with HTTP 400 when any flow sends consecutive same-role messages via custom OpenAI-compatible endpoints #4154
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#4154
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 @minouris on GitHub (Oct 12, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7457
Originally assigned to: @SpicyMarinara on GitHub.
Summary
Any flow that sends two consecutive same-role messages through a
custom(OpenAI-compatible) connection to a local model with a strict Mistral-family Jinja template fails with HTTP 400Unable to generate parser for this template ... conversation roles must alternate user/assistant/user/assistant/.... Only the Anthropic provider merges consecutive roles; the OpenAI-compatible path passes them straight through.Expected behavior
Requests to strict-template local models should either have consecutive same-role messages merged client-side (as already done for Anthropic), or fail with an actionable Marinara-side message — not a raw llama.cpp parser 400.
Actual behavior
Professor Mari could not answer right now. Custom OpenAI-compatible endpoint error 400: Unable to generate parser for this template. Automatic parser generation failed: ... raise_exception("After the optional system message, con.... Same failure is reachable from normal generation via post-assembly pushes (see below).Steps to reproduce
customconnection in Marinara. Model links: card https://huggingface.co/TheDrummer/Rocinante-X-12B-v1, GGUF https://huggingface.co/TheDrummer/Rocinante-X-12B-v1-GGUF (file served:Rocinante-X-12B-v1b-Q5_K_M.gguf).assistant(continue/swipe), or impersonate where history ends onuser.llamalogs confirm the template'sraise_exceptionduring parser generation.Environment
ghcr.io/pasta-devs/marinara-engine:2.5.0)Logs, screenshots, or video
llama child log (failing request):
got exception: {"error":{"code":400,"message":"Unable to generate parser for this template. Automatic parser generation failed: ... While executing CallExpression at line 18, column 32 ... raise_exception(\"After the optional system message, con... Error: Jinja Exception: After the optional system message, conversation roles must alternate user/assistant/user/assistant/...","type":"invalid_request_error"}}Marinara log just before:
Professor Mari returned an invalid workspace command frame; requesting protocol repair.Additional context
Confirmed sender-side emitters (v2.5.0 tag):
workspace-agent.service.ts), so neithermergeAdjacentMessagesnorenforceStrictRolesever runs there. Verification repair pushes assistant + user(command results) + user(verification) (user,user); round-limit pushes user + user.enforceStrictRoleswhenstrictRoleFormattingis true (default preset), but the impersonateuserpush (generate.routes.ts:6843) and trailingassistantprefill (appendGenerationTailMessages,generate-route-utils.ts:1153) are appended AFTER assembly and bypass it.enforceStrictRolesalso skipsassistantturns withproviderMetadataor differingcharacterId/audience (assembler.ts:1157-1164), so strict-template 400s stay reachable there.openai.provider.ts:formatMessagesdoes no merging; the only in-code merges are Anthropic-only (anthropic.provider.ts:1121),agent-executor.ts:2930(appends into trailinguser), and the assembler.Related history (none cover custom endpoints): #2289/#2395 (strict roles for Anthropic/Google), #5915 (post-processing selector request), #2792 (custom-endpoint tool-call compat). Searched
Unable to generate parser,conversation roles must alternate,Rocinante,Mistral,jinja,alternation,strict template— no matching open report.Ruled out:
models.ini/llama preset config (router spawns with correct--ctx-size;meta.n_ctxreflects per-slot size), response_format (undefined forcustom), and server flags (llama.cpp has no auto-merge flag; builtinmistral-v3-tekkenis equally strict — verified against v0.6.0 templates).Serving preset for the reproducing model (llama.cpp router
models.ini; note nochat-template-fileline, so the embedded strict Tekken template applies):Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:
@SpicyMarinara commented on GitHub (Oct 12, 2026):
Fixed on staging by #7486.
@minouris commented on GitHub (Oct 12, 2026):
Thanks @SpicyMarinara, that's working much better now :)