Nodes/ComfyUI-AutoFlow/Path Validator
ComfyUI Node

Path Validator

Check that path before you feed it to a loader

By ZXL-Xinram·Created about a year ago·Updated 9 months ago· 4
Path Validator
    • is_valid
    • exists
    • error_message
    path
    check_existencetrue

    Loaders in ComfyUI fail at load time, with an error buried in the console, after you've already queued the job. Path Validator is the pre-flight check: feed it a path and it tells you whether the path is even well-formed, whether it actually exists on disk, and - usefully - why not, as a human-readable string you can pipe into a text display.

    It's the third leg of the pack's path trio (Parser tears apart, Joiner builds, Validator checks), and the only one that touches the filesystem.

    How it works

    Two checks, controlled separately. First it validates that the path normalizes cleanly via os.path.normpath - that's the "well-formed" test. Then, if check_existence is on (default), it runs os.path.exists on the actual path and reports whether the file or folder is really there. A path that's empty returns is_valid = False with the message "Path is empty."

    Inputs and outputs

    • path - the string to check.
    • check_existence - boolean, default true. Turn it off if you only care about format (e.g. validating a path you're about to create, which won't exist yet).

    Outputs:

    • is_valid - BOOLEAN: is the path well-formed.
    • exists - BOOLEAN: does it exist (meaningless if check_existence is off).
    • error_message - a STRING explaining why it failed ("Path is empty", "Invalid path format: …", "Path does not exist"), empty on success.

    Install

    Standard pack install - ComfyUI Manager (search "ComfyUI-AutoFlow") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ZXL-Xinram/ComfyUI-AutoFlow
    

    Restart after. No dependencies beyond os.

    Where people get burned

    • is_valid is about format, not existence. A well-formed path to a file that doesn't exist still validates as is_valid = True while exists = False. Don't use the wrong flag for the check you want.
    • Permissions and network drives. os.path.exists returns False for paths you can't access or that live on a disconnected share - and that's indistinguishable from "not there." If a drive path fails, check the mount first.
    • It's a checker, not a creator. Nothing here makes directories or files. If you're validating a path for later creation, set check_existence off, or it will always fail.

    The realistic use: gate a loader with exists, or wire error_message into a text display so a failing batch run tells you which path was the problem instead of dumping a traceback. In automation-heavy graphs that alone justifies the node.

    CategoryAutoFlow/Utilities

    Inputs (2)

    NameTypeDefaultDescription
    pathSTRING
    check_existenceBOOLEANtrueWhether to check if path exists

    Outputs (3)

    NameTypeDescription
    is_validBOOLEAN
    existsBOOLEAN
    error_messageSTRING