mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #5058] Illustrator payload failure nanogpt image #2800
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#2800
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 @ghost on GitHub (Aug 15, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5058
Originally assigned to: @SpicyMarinara on GitHub.
Bug: NanoGPT image generation broken — 413 with reference images, and silent response-parsing failure without reference images (regression)
Summary
NanoGPT image generation is broken in two ways, both regressions from a previously working state (was fine a couple updates ago):
413 Request Entity Too Large(FUNCTION_PAYLOAD_TOO_LARGE) — base64 reference images are packed directly into the JSON body with no payload-size guard.Environment
Version: 2.4.3
Build: 2.4.3+531e323032f4
Commit:
531e323032OS: Android 17
Browser / app shell: Mozilla/5.0 (Linux; Android 17; SM-F976U1 Build/CP2A.260605.016; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/150.0.7871.181 Safari/537.36 MarinaraEngine/Android
GPU: Adreno (TM) 840
Active connection: Z.Ai
Connection provider: custom
LLM model: glm-5.2
nanogpt)Error 1 — 413 with reference images
Log entry:
Root cause:
generateNanoGPT()atpackages/server/src/services/image/image-generation.ts:1322–1371packs reference images as base64 data URLs directly into the JSON request body:The limit is 3 reference images (
NANOGPT_REFERENCE_IMAGE_LIMIT = 3, line 528). Base64 encoding adds ~33% overhead, so multiple high-res references easily exceed the serverless function payload limit (~4.5 MB on Vercel-style deployments like NanoGPT'siad1region). There is no client-side payload-size guard before sending.Suggested fix: Add a payload-size estimate before sending. If the estimated payload exceeds a threshold (e.g., 4 MB), either downscale reference images, reduce the count, or fail with a descriptive error instead of letting the provider return a cryptic 413.
Error 2 — Broken image without reference images (the bigger issue)
Symptoms:
Likely root cause: The NanoGPT response parser at lines 1365–1370 only handles two response shapes:
If NanoGPT changed their API response format (e.g., returning a different field name, a nested structure, or a URL that fails the
downloadImageUrlfetch/SSRF policy), the parser throws"No image data in NanoGPT response", the error is caught in the retry route, and an error event is sent to the client — which renders as the broken image + error text wall.Notably, the OpenAI parser (lines 966–981) handles three fields (
b64_json,image_base64,url) and provides a detailed error message listing the actual response fields. The NanoGPT parser handles only two (b64_json,url) and gives a bare error with no diagnostic info. This asymmetry suggests the NanoGPT parser was not updated to match newer response formats.Suggested fixes:
image_base64,image_url,output,result)downloadImageUrlis failing, log the specific failure reason (SSRF policy, network error, non-200 status)response_format: "b64_json"parameter (line 1331) is still being honored by NanoGPT's endpointSteps to reproduce
Expected behavior
Additional note — Illustrator agent connection ID mismatch
The Illustrator agent config has two different connection IDs:
connectionId:HiVmezWsvsi-46vhyhEUEsettings.imageConnectionId:OHeHzvMw0D_psYgAfxTTsThe retry route resolves the image connection from
settings.imageConnectionId(line 499), not the top-levelconnectionId. If these point to different providers, it could cause confusion about which connection is actually used.@SpicyMarinara commented on GitHub (Aug 15, 2026):
I’m taking this one. NanoGPT’s current official image endpoint supports URL responses with base64 fallback and caps image uploads at 4 MB, so I’ll keep the fix provider-specific: bound the JSON reference payload, prefer immediate signed-URL download, harden the fallback parser, and add an end-to-end provider regression.