Nodes/ComfyUI-JDCN/LogicUtil_ErrorNode
ComfyUI Node

LogicUtil_ErrorNode

The node that's supposed to crash your workflow

By daxcay·Created 2 years ago·Updated about a year ago· 160
LogicUtil_ErrorNode
    • STRING
    error_msgError

    LogicUtil_ErrorNode exists to fail on purpose. Feed it a message and it raises an exception, halting the queue with whatever text you typed. Sounds like a joke node - it isn't. Fail-fast is a genuinely useful pattern in ComfyUI, especially once your workflows stop being single-image toys and start being automation.

    What it's actually for

    ComfyUI evaluates a graph top to bottom and doesn't stop mid-run just because something's off; it keeps generating, often wasting minutes, before you notice the input was wrong. An error node gives you an on-ramp to deliberate failure: you wire it after a check (a logic gate, a file-list node, a counter), and if the condition says "don't continue," you abort the run with a message that tells you why.

    Concrete cases:

    • A file list came back empty - fire the error with "No images found in folder" instead of silently running an empty batch.
    • A validation step before a long video render detects a bad path - stop before burning GPU time.
    • You're testing error handling in a workflow or a custom node and want a reliable way to throw.

    How it works

    One required input, error_msg, a plain string (default "Error"). The function does exactly one thing: raise Exception("Error: {error_msg}"). It's marked with a STRING output in its schema, but don't wire that output anywhere expecting a value - the exception fires before anything is returned. Think of it as a one-way trip: whatever's upstream of it already ran, and everything downstream never will.

    It's part of the small LogicUtil suite bundled inside this pack (logic gates, converters, math helpers - same authors). In the node menu it shows up under LogicUtil, not the blue JDCN category, so don't go hunting under "JDCN" for it.

    Installing it

    It ships with ComfyUI-JDCN, so:

    • ComfyUI ManagerInstall Custom Node → search JDCN → install ComfyUI-JDCN → restart.
    • Or:
    cd ComfyUI/custom_nodes
    git clone https://github.com/daxcay/ComfyUI-JDCN.git
    cd ComfyUI-JDCN
    pip install -r requirements.txt
    

    Restart and it appears under LogicUtil. The pack's only dependency is piexif; nothing to download beyond the code.

    Common issues

    The obvious trap: this node should look like an error in the console. If you dropped it into a workflow to "test" something and your queue keeps dying, that's working as intended - remove it or gate it behind a condition. The error_msg string is plain text, no f-strings or variable interpolation, so if you want dynamic messages (like the failing path), you need to build the string upstream with something like the pack's ConvertAny2String and feed the result in.

    One more thing worth knowing: because it raises a raw exception, ComfyUI will show it as a failed run and stop the current queue. If your batch job is supposed to keep going past a missing file, gate the error node so it only fires when you genuinely want a hard stop.

    CategoryLogicUtil

    Inputs (1)

    NameTypeDefaultDescription
    error_msgSTRINGError

    Outputs (1)

    NameTypeDescription
    STRINGSTRING