mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #4597] [Issue]: Noodler post creation fails with "expected object, received array" ZodError #2508
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#2508
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 @MetzeVanDeus on GitHub (Aug 4, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4597
Originally assigned to: @Gunterlie on GitHub.
Summary
Noodler post creation consistently fails with
ZodError: Expected object, received arrayregardless of model, context, or retry attempts. The LLM returns a JSON array[{title, content}]even though the system prompt explicitly instructs "Return one JSON object."Expected behavior
When generating a Noodler post, the response should be parsed successfully and the post saved to the database. The Noodler should appear on the creator's page without errors.
Actual behavior
The Noodler post creation fails with:
The LLM returns
[{ "title": "...", "content": "..." }](array with one object) instead of{ "title": "...", "content": "..." }(plain object). This happens on the first attempt and persists even after the correction prompt ("Return exactly one object with title and content only").Steps to reproduce
Environment
cab61fc088, staging branchLogs, screenshots, or video
Server log:
Generation log (model response):
Model returns:
The system prompt includes: "Return one JSON object with title and content only." — but the model wraps it in an array anyway.
Additional context
This affects local LLM models (Ollama, KoboldCPP, LM Studio) that don't fully respect the
{"type": "json_object"}response format parameter. The model interprets it as "return JSON" rather than "return a JSON object type."I've developed a fix locally — will open a PR once the issue is acknowledged
The fix is a small guard in
parseNoodlerPost()that unwraps single-element arrays before Zod validation:This is a minimal, targeted fix that handles the case at the parsing layer regardless of what the model returns.
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 (Aug 4, 2026):
@Gunterlie
@Gunterlie commented on GitHub (Aug 4, 2026):
@MetzeVanDeus Yes, make the PR :)
@SpicyMarinara commented on GitHub (Aug 4, 2026):
Awesome, thank you for the PR!