[GH-ISSUE #299] [Issue]: No way to utilize reference images with ComfyUI. #121

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

Originally created by @emersonsorrel on GitHub (Apr 28, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/299

Summary

The app provides the ability to use reference images with ComfyUI, however the current implementation doesn't properly pass them to the workflow using the %reference_image% placeholder.

Expected behavior

The character reference image should be passed to an image-capable model (Qwen Image Edit or Flux Klein, for instance) using the %reference_image% placeholder in the ComfyUI JSON. This should provide the model a starting point for the character's expected look and features.

Actual behavior

%reference_image% is not updated with a file name prior to being sent to the ComfyUI workflow. Error produced: "FileNotFoundError: [Errno 2] No such file or directory: '/Applications/Data/Packages/ComfyUI/input/%reference_image%'"

Steps to reproduce

  1. Load ComfyUI JSON replacing "load image" node filename with %reference_image%.
  2. Attempt to generate image.
  3. Observe failure.

Environment

  • Marinara Engine version: 1.5.5, build b8d82ca
  • Install type: Termux (I think. I just followed the commands from the Github page.)
  • OS + version: MacOS 26.3.1
  • Browser or app shell: Safari

Logs, screenshots, or video

Additional context

I attempted to troubleshoot with Claude to see if there was some way to format my JSON that would just make it work, but no success. Claude's suggestion was such:

The error tells you everything: '/Applications/Data/Packages/ComfyUI/input/%reference_image%' — Marinara is doing a simple string substitution of %variable% tokens in the workflow JSON and passing the result straight to ComfyUI's /prompt API. That works fine for strings like %prompt% and %seed%, but %reference_image% is a special case because LoadImage doesn't accept an arbitrary path — it only accepts filenames relative to its own /input/ directory.

So you have two options depending on how far you want to take this:

Option 1 — The easy workaround (no code changes)

Pre-copy your reference image into ComfyUI's input folder and just use the filename directly in the workflow. Instead of %reference_image% as a variable at all, hardcode the filename for now:

"10": {
  "inputs": {
    "image": "my_character.png"
  },
  "class_type": "LoadImage",
  ...
}

This bypasses the variable system entirely and at least confirms the rest of your workflow is wired correctly.

Option 2 — Proper integration (requires a code contribution)

Marinara would need to intercept %reference_image% before sending the workflow, upload the image to ComfyUI via POST /upload/image, and substitute the returned filename in its place. That's a feature request / PR for the project rather than something you can fix in the JSON alone.

Worth checking their Discord (linked in the README) to see if there's an existing issue or PR for image upload support — it's a pretty natural thing to want once ComfyUI integration is in place.

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 @emersonsorrel on GitHub (Apr 28, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/299 ## Summary The app provides the ability to use reference images with ComfyUI, however the current implementation doesn't properly pass them to the workflow using the %reference_image% placeholder. ## Expected behavior The character reference image should be passed to an image-capable model (Qwen Image Edit or Flux Klein, for instance) using the %reference_image% placeholder in the ComfyUI JSON. This should provide the model a starting point for the character's expected look and features. ## Actual behavior %reference_image% is not updated with a file name prior to being sent to the ComfyUI workflow. Error produced: "FileNotFoundError: [Errno 2] No such file or directory: '/Applications/Data/Packages/ComfyUI/input/%reference_image%'" ## Steps to reproduce 1. Load ComfyUI JSON replacing "load image" node filename with %reference_image%. 2. Attempt to generate image. 3. Observe failure. ## Environment - Marinara Engine version: 1.5.5, build b8d82ca - Install type: Termux (I think. I just followed the commands from the Github page.) - OS + version: MacOS 26.3.1 - Browser or app shell: Safari ## Logs, screenshots, or video <!-- Paste relevant logs and add screenshots when possible --> ## Additional context I attempted to troubleshoot with Claude to see if there was some way to format my JSON that would just make it work, but no success. Claude's suggestion was such: The error tells you everything: `'/Applications/Data/Packages/ComfyUI/input/%reference_image%'` — Marinara is doing a simple string substitution of `%variable%` tokens in the workflow JSON and passing the result straight to ComfyUI's `/prompt` API. That works fine for strings like `%prompt%` and `%seed%`, but `%reference_image%` is a special case because `LoadImage` doesn't accept an arbitrary path — it only accepts filenames relative to its own `/input/` directory. So you have two options depending on how far you want to take this: **Option 1 — The easy workaround (no code changes)** Pre-copy your reference image into ComfyUI's input folder and just use the filename directly in the workflow. Instead of `%reference_image%` as a variable at all, hardcode the filename for now: ```json "10": { "inputs": { "image": "my_character.png" }, "class_type": "LoadImage", ... } ``` This bypasses the variable system entirely and at least confirms the rest of your workflow is wired correctly. **Option 2 — Proper integration (requires a code contribution)** Marinara would need to intercept `%reference_image%` before sending the workflow, upload the image to ComfyUI via `POST /upload/image`, and substitute the returned filename in its place. That's a feature request / PR for the project rather than something you can fix in the JSON alone. Worth checking their Discord (linked in the README) to see if there's an existing issue or PR for image upload support — it's a pretty natural thing to want once ComfyUI integration is in place. ## 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.
bsakaguchi 2026-10-20 17:25:23 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@SpicyMarinara commented on GitHub (Apr 28, 2026):

v1.5.6 should address this.

<!-- gh-comment-id:4339297224 --> @SpicyMarinara commented on GitHub (Apr 28, 2026): v1.5.6 should address this.
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#121
No description provided.