[GH-ISSUE #973] [Feature]: Fall back to a 1×1 placeholder image when ComfyUI workflows use %reference_image%/%reference_image_name% with no reference #475

Closed
opened 2026-10-20 17:29:15 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Yasyasyasvil on GitHub (May 18, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/973

Originally assigned to: @cha1latte on GitHub.

What problem does this solve?

For ComfyUI custom workflows that support reference-image placeholders %reference_image% / %reference_image_name% but the generation request has no reference image, the substitution code skips the replacement entirely. The literal %reference_image% / %reference_image_name% text is sent to ComfyUI inside the workflow JSON, and the LoadImage chain crashes when it tries to decode the placeholder as base64 or look up that filename.

ComfyUI workflows can be designed to be dual-purpose: they run as image-to-image when a reference is supplied and as text-to-image when one isn't. In both modes the LoadImage node still needs a valid image to load.

This is easy to trigger through normal product paths, for example:

  • Illustrator runs with "Send character & persona avatars as reference images" disabled, or with the setting enabled but no matching characters resolved.
  • Sprite-sheet generation kicked off without an uploaded reference and without the "use current avatar" checkbox.
  • Game scene illustration on a scene where no tracked NPCs / chat characters have references.

Proposed solution

Add a per-connection setting on the ComfyUI workflow editor, a checkbox labelled "Upload a 1×1 placeholder when no reference image is provided".

Behavior when the setting is enabled and the request has no reference image:

  • %reference_image% -> base64 of a bundled 1×1 PNG
  • %reference_image_name% -> filename returned from uploading that same 1×1 PNG via /upload/image.

Behavior when the setting is disabled: preserve today's behavior (the placeholders remain unsubstituted and the workflow will fail if it depends on them)

Alternatives considered

  • Strip the reference nodes from the workflow at runtime when no reference exists. Requires parsing the workflow graph, identifying the LoadImage subtree, and rerouting downstream nodes. Fragile against user-customized workflows.

Additional context

The substitution is a simple change to image-generation.ts

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Yasyasyasvil on GitHub (May 18, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/973 Originally assigned to: @cha1latte on GitHub. ## What problem does this solve? For ComfyUI custom workflows that support reference-image placeholders `%reference_image%` / `%reference_image_name%` but the generation request has no reference image, the substitution code skips the replacement entirely. The literal `%reference_image%` / `%reference_image_name%` text is sent to ComfyUI inside the workflow JSON, and the LoadImage chain crashes when it tries to decode the placeholder as base64 or look up that filename. ComfyUI workflows can be designed to be dual-purpose: they run as image-to-image when a reference is supplied and as text-to-image when one isn't. In both modes the LoadImage node still needs a valid image to load. This is easy to trigger through normal product paths, for example: - Illustrator runs with "Send character & persona avatars as reference images" disabled, or with the setting enabled but no matching characters resolved. - Sprite-sheet generation kicked off without an uploaded reference and without the "use current avatar" checkbox. - Game scene illustration on a scene where no tracked NPCs / chat characters have references. ## Proposed solution Add a per-connection setting on the ComfyUI workflow editor, a checkbox labelled **"Upload a 1×1 placeholder when no reference image is provided"**. Behavior when the setting is enabled and the request has no reference image: - `%reference_image%` -> base64 of a bundled 1×1 PNG - `%reference_image_name%` -> filename returned from uploading that same 1×1 PNG via `/upload/image`. Behavior when the setting is disabled: preserve today's behavior (the placeholders remain unsubstituted and the workflow will fail if it depends on them) ## Alternatives considered - Strip the reference nodes from the workflow at runtime when no reference exists. Requires parsing the workflow graph, identifying the LoadImage subtree, and rerouting downstream nodes. Fragile against user-customized workflows. ## Additional context The substitution is a simple change to image-generation.ts ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
Author
Owner

@cha1latte commented on GitHub (May 18, 2026):

Triage note: labeling this as normal-scope because it is a focused ComfyUI reliability option for an existing workflow-editor placeholder path, with current behavior preserved when the setting is disabled.

This can stay in the normal enhancement backlog as a bounded image-generation compatibility improvement.

<!-- gh-comment-id:4480647890 --> @cha1latte commented on GitHub (May 18, 2026): Triage note: labeling this as `normal-scope` because it is a focused ComfyUI reliability option for an existing workflow-editor placeholder path, with current behavior preserved when the setting is disabled. This can stay in the normal enhancement backlog as a bounded image-generation compatibility improvement.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#475
No description provided.