Validate Dict
The 30-second sanity check before your prompt library hits the formatter
- dict
- dict
The String Constructor pack works on the idea that you build a dictionary of named prompt chunks once and pass it around as a single connection. Validate Dict is the pack's quick trip to the doctor before that dict goes anywhere important: it checks that every key in the dictionary is a name the String Formatter can actually use, and it passes the dict through untouched. That's the entire job - one input, one output, no settings.
You don't strictly need it. The String Formatter itself will warn you about a bad key the moment it tries to format it. The author's own description is candid about this: it's handy "right after the keys are set," at the very start of the graph, so you catch a typo'd or punctuation-laden key in seconds instead of after a whole branch of nodes has built around it. Where it genuinely earns its keep is when your dictionary comes from another pack's node - a merge node, a JSON parser, a WAS Node Suite-style dict builder. Those tools don't enforce the same naming rules, so garbage can ride in silently.
How it works
Under the hood it's a straightforward validator, not a fixer. It checks each key against the rules Python's str.format() demands: the key must be a string, non-empty, made only of ASCII letters, digits, and underscores, and it can't start with a digit. Any violation raises a single, well-grouped error message that tells you exactly which keys failed and why - not a string, empty, starts with a digit, or contains invalid characters.
Inputs and output
There's one optional input, dict (a DICT connection), and one output, also dict - the exact same dictionary, unmodified. It's a pass-through node; nothing gets transformed or cleaned. If validation fails it raises instead, which in ComfyUI means you see the red error and the graph stops rather than silently formatting a wrong prompt. Don't feed it a string or a number instead of a dict - it'll raise a "not a dict" type error, which is itself a decent diagnostic when you've wired something wrong.
Install and using it
Same deal as the rest of the pack - ComfyUI Manager, search "String Constructor", or:
cd ComfyUI/custom_nodes
git clone https://github.com/Lex-DRL/ComfyUI-StringConstructor
Restart, and the only dependency is frozendict - no models, no heavy packages. To use it, drop it right after whatever node produces your dictionary, then wire its output forward into your String Formatter. It's an "output node" too, so you can just double-click it into existence and see the verdict without connecting anything.
Where people get tripped up: the validator catches naming problems, not semantic ones - a valid key pointing at empty text or the wrong chunk still passes. And remember that since v3.x, the dict-building nodes live in the separate ComfyUI-DictTools pack, so if you're assembling dictionaries from scratch you'll want that one alongside. For a node that's technically optional, this one turns "why is my prompt full of unformatted {stuff}?" into a two-second answer.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| dictopt | DICT | An (optional) Format-Dictionary to work with. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| dict | DICT | — |