Nodes/Promptcraft/Random Prompts (Debug)
ComfyUI Node

Random Prompts (Debug)

The same node, minus the tantrums

By rTachibana·Created 5 months ago·Updated 5 months ago· 1
Random Prompts (Debug)
    • Resolved Prompt
    text
    seed0

    The normal Random Prompts node has one personality flaw: if your template has a syntax error - an unmatched {, an unclosed __ - it refuses to run and blocks the whole workflow. Great when you're guarding a batch, miserable when you're still typing and every intermediate state is "broken." Random Prompts (Debug) is the version that keeps its mouth shut and shows you the problem instead of throwing one.

    What's different

    Same node, same inputs, same output - the entire difference is error handling. The debug variant validates the template before generating, and:

    • On a syntax error, it doesn't throw. The error list prints right on the node in a preview area, the output is an empty string, and the workflow keeps going. You fix the typo, run again, done.
    • On success, it resolves the template and previews the final prompt on the node, same as Show Text would.

    That's it. There's no extra configuration, no debug toggle - you just swap the node in while you're writing a template, then swap back to the strict version once it's clean. The strict one is the safety net; this one is the writing surface.

    The trap nobody tells you

    Because it never stops the workflow, it will also happily run when the template is broken - and the Resolved Prompt output on an error is an empty string. If you wire it straight into CLIPTextEncode while editing, you can generate a batch of images from a silently empty prompt and not notice until later. The debug node protects your session, not your output. Keep Show Text or the on-node preview in view, or just remember that an empty preview = empty prompt.

    Inputs and output

    • Prompt Template (multiline STRING) - same syntax as Random Prompts: {A|B|C} variants, __wildcard__ lookups, ${var=!value} variables, # comments. The line-number gutter applies here too.
    • seed (INT) - defaults to randomize-on-generate; set it fixed to reproduce a specific resolution.
    • Resolved Prompt (STRING) - the fully resolved text, or "" if validation found errors.

    Installing it

    It's part of the Promptcraft pack, so there's nothing special to install beyond that. Manager (search "Promptcraft") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/rTachibana/comfyui-promptcraft
    

    Restart ComfyUI, and all three nodes - Random Prompts, Random Prompts (Debug), Show Text - land in the Promptcraft category together. No models, no Python deps beyond the optional PyYAML for .yaml wildcard files, and the same catch as the rest of the pack: it needs ComfyUI ≥ 0.18.0 (V3 API), or none of these nodes will show up at all.

    Should you use it?

    For a beginner, honestly, this is the one to reach for while you learn the syntax - the on-node error messages are friendlier than "workflow failed, here's a stack trace." Once your templates are stable, switch to the strict Random Prompts so a typo can't silently feed an empty prompt to the encoder. They're two faces of the same node; you want both on the palette.

    CategoryPromptcraft

    Inputs (2)

    NameTypeDefaultDescription
    textSTRINGPrompt template. {A|B|C} — pick one at random __name__ — wildcard from file # comment — ignored
    seedINT00–18446744073709550000Random seed. Set 'control after generate' to 'fixed' for reproducible results.

    Outputs (1)

    NameTypeDescription
    Resolved PromptSTRINGThe resolved prompt, or empty string if there are syntax errors.