mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
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#2064
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 @GetBeholder on GitHub (Jul 19, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3828
Originally assigned to: @SpicyMarinara on GitHub.
Summary
packages/server/src/services/image/image-generation.tsstill exhibits the exact bug described in #1275 — indexed ComfyUI reference placeholders (%reference_image_name_02%,%reference_image_name_03%, …) are never substituted when the scene has fewer reference images than the workflow declares slots for. They leak to ComfyUI as literal text and the queue rejects the workflow withInvalid image file: %reference_image_name_02%(or similar).That bug was already fixed on the Tauri side in PR #1319 (
src-tauri/src/commands/storage/images/providers.rs—collect_comfy_reference_name_tokens+ missing-slot placeholder padding) and #1275 was closed accordingly. However the fix was never mirrored to the Marinara Engine's Node/TypeScript codebase (packages/server/src/services/image/image-generation.tsandrunpod-comfyui.service.ts), where the same loop still stops atreferences.lengthwithout padding remaining indexed placeholders.Expected behavior
For any ComfyUI workflow that uses indexed reference placeholders, every
%reference_image_NN%/%reference_image_name_NN%should be substituted:COMFYUI_PLACEHOLDER_REFERENCE_BASE64(subject todefaults.uploadPlaceholderOnMissingReference).Matches the Tauri behavior from PR #1319.
Actual behavior
Current
image-generation.ts(Engine v2.3.3,stagingbranch as of $(date -u +%Y-%m-%d)):```ts
const references = collectComfyReferenceImages(request, defaults);
for (let i = 0; i < references.length; i++) {
// fills only slots 1..references.length
}
const resolvedWorkflow = replaceComfyUiPlaceholders(workflow, replacements);
```
The loop is bound by
references.length. If the workflow uses%reference_image_name_02%and the scene supplies 1 reference, that placeholder stays literal and ComfyUI rejects the payload.runpod-comfyui.service.tshas the same shape (line ~111) and the same defect.collectComfyReferenceImages's placeholder fallback (line ~2422) fires only whenreferences.length === 0and then only fills slot 1 — it never pads slots 2..N.Steps to reproduce
LoadImagenodes using%reference_image_name_01%,_02%,_03%.[selfie]command (only one reference image is available).400 prompt_outputs_failed_validationwithdetails: "image - Invalid image file: %reference_image_name_02%".Prior art
cha1latte, merged) —src-tauri/src/commands/storage/images/providers.rsfillborders— separate concern; that fix has its own PR pending)Suggested fix
Port the Tauri logic to the Engine's Node/TS side. Concretely, after the existing
for (let i = 0; i < references.length; i++)loop ingenerateComfyUI:ifromreferences.lengthup toCOMFYUI_MAX_REFERENCE_IMAGES.i, ifworkflowJson.includes("%reference_image_${padded}%")setreplacements[...] = COMFYUI_PLACEHOLDER_REFERENCE_BASE64.i, ifworkflowJson.includes("%reference_image_name_${padded}%"), upload the placeholder image once (memoize) viauploadComfyReferenceImageand use the returned filename for every unfilled name slot.defaults.uploadPlaceholderOnMissingReferenceso the opt-out semantics stay consistent.Mirror the same in
runpod-comfyui.service.ts(string-substitution flavor, no separate upload step).Happy to author the port if useful — flagging first so we don't double-work if a mirror-port PR is already in flight.
Environment
stagingHEAD)@SpicyMarinara commented on GitHub (Jul 19, 2026):
Claimed by @SpicyMarinara in draft PR #3835 for this assigned issue sweep.
@SpicyMarinara commented on GitHub (Jul 19, 2026):
Addressed in #3835: local and RunPod ComfyUI workflows now pad only declared missing indexed reference slots using the existing placeholder behavior, with focused regression coverage.