[GH-ISSUE #875] [Issue]: Default ComfyUI workflow sends width/height as strings #426

Closed
opened 2026-10-20 17:28:44 +07:00 by bsakaguchi · 0 comments
Owner

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

Originally assigned to: @cha1latte on GitHub.

Summary

The bundled/default ComfyUI workflow can fail because numeric placeholders such as %width% and %height% are substituted after the workflow is stringified, leaving ComfyUI with string values instead of numbers.

This makes the default ComfyUI path fail before an image is produced.

Expected behavior

The default ComfyUI workflow should queue and run without requiring users to paste a custom workflow. Numeric workflow inputs should be sent as numbers, for example:

"width": 512,
"height": 768

Actual behavior

ComfyUI receives numeric fields as strings, for example:

"width": "512",
"height": "768"

Then ComfyUI crashes in the EmptyLatentImage node when it tries to divide the height by 8.

Steps to reproduce

  1. Create an Image Generation connection using ComfyUI.
  2. Leave the ComfyUI workflow field empty so Marinara uses the bundled/default workflow.
  3. Trigger image generation through a ComfyUI-backed image flow.
  4. Check the ComfyUI terminal/logs.

Environment

  • Marinara Engine version: current main/staging behavior observed from support report; exact user version not yet confirmed
  • Install type: not yet confirmed
  • OS + version: not yet confirmed
  • Browser or app shell: not yet confirmed
  • Image backend: ComfyUI

Logs, screenshots, or video

User-reported ComfyUI error:

latent = torch.zeros([batch_size, 4, height // 8, width // 8],
  device=comfy.model_management.intermediate_device(),
  dtype=comfy.model_management.intermediate_dtype())
TypeError: unsupported operand type(s) for //: 'str' and 'int'

Relevant code path appears to be packages/server/src/services/image/image-generation.ts:

  • DEFAULT_COMFYUI_WORKFLOW defines EmptyLatentImage.inputs.width / height as %width% / %height% string placeholders.
  • generateComfyUI() runs JSON.stringify(workflow), replaces %width% and %height% with numeric-looking text, then parses the JSON again.
  • Because the placeholders were inside JSON string values, the parsed values remain strings.

Additional context

Workaround for affected users:

Paste a custom ComfyUI workflow and hard-code numeric values in the EmptyLatentImage node, for example:

"width": 512,
"height": 768,
"batch_size": 1

A likely fix is to replace workflow placeholders with type-aware traversal before stringifying, or to coerce exact numeric placeholders such as %width%, %height%, %seed%, %steps%, %cfg%, %denoise%, and %clip_skip% into numbers when they occupy a whole JSON value.

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 @Xelvanis on GitHub (May 15, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/875 Originally assigned to: @cha1latte on GitHub. ## Summary The bundled/default ComfyUI workflow can fail because numeric placeholders such as `%width%` and `%height%` are substituted after the workflow is stringified, leaving ComfyUI with string values instead of numbers. This makes the default ComfyUI path fail before an image is produced. ## Expected behavior The default ComfyUI workflow should queue and run without requiring users to paste a custom workflow. Numeric workflow inputs should be sent as numbers, for example: ```json "width": 512, "height": 768 ``` ## Actual behavior ComfyUI receives numeric fields as strings, for example: ```json "width": "512", "height": "768" ``` Then ComfyUI crashes in the `EmptyLatentImage` node when it tries to divide the height by 8. ## Steps to reproduce 1. Create an Image Generation connection using ComfyUI. 2. Leave the ComfyUI workflow field empty so Marinara uses the bundled/default workflow. 3. Trigger image generation through a ComfyUI-backed image flow. 4. Check the ComfyUI terminal/logs. ## Environment - Marinara Engine version: current main/staging behavior observed from support report; exact user version not yet confirmed - Install type: not yet confirmed - OS + version: not yet confirmed - Browser or app shell: not yet confirmed - Image backend: ComfyUI ## Logs, screenshots, or video User-reported ComfyUI error: ```text latent = torch.zeros([batch_size, 4, height // 8, width // 8], device=comfy.model_management.intermediate_device(), dtype=comfy.model_management.intermediate_dtype()) TypeError: unsupported operand type(s) for //: 'str' and 'int' ``` Relevant code path appears to be `packages/server/src/services/image/image-generation.ts`: - `DEFAULT_COMFYUI_WORKFLOW` defines `EmptyLatentImage.inputs.width` / `height` as `%width%` / `%height%` string placeholders. - `generateComfyUI()` runs `JSON.stringify(workflow)`, replaces `%width%` and `%height%` with numeric-looking text, then parses the JSON again. - Because the placeholders were inside JSON string values, the parsed values remain strings. ## Additional context Workaround for affected users: Paste a custom ComfyUI workflow and hard-code numeric values in the `EmptyLatentImage` node, for example: ```json "width": 512, "height": 768, "batch_size": 1 ``` A likely fix is to replace workflow placeholders with type-aware traversal before stringifying, or to coerce exact numeric placeholders such as `%width%`, `%height%`, `%seed%`, `%steps%`, `%cfg%`, `%denoise%`, and `%clip_skip%` into numbers when they occupy a whole JSON value. ## 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:28:44 +07:00
  • closed this issue
  • added the
    bug
    label
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#426
No description provided.