Prompt Stack:
Archived source: The original repository benstaniford/comfy-prompt-db is unavailable. This page documents the preserved implementation at commit 8fcd089332af. It is a historical source snapshot, not a claim that the original repository is maintained or currently installable.
PromptStack combines saved prompt text from your prompt database into one string. It looks up each selected prompt, keeps the entries that are enabled and found in the database, and joins their text in row order. This lets you build a longer prompt from reusable pieces without repeatedly copying and pasting them.
Prompt Stack Input Parameters:
separator
A STRING placed between the text of each included prompt. Its default is , (a comma followed by a space). For example, two saved prompts containing “soft lighting” and “detailed background” produce “soft lighting, detailed background” with the default separator. You can use a different string, including an empty string, to change how the pieces meet. No minimum or maximum length is specified.
preview_text
A multiline STRING with the default Preview of stacked prompts will appear here.... It is present in the node interface, but the provided implementation does not use its value when building the result. Changing it does not change the stacked prompt. No minimum or maximum length is specified.
prompt_1_category
An optional category dropdown that identifies where to look for the first selected prompt. Its options come from the category keys in your prompts.json database, so there is no fixed list. The default is the first available category; if none are available when the interface is built, the fallback option and default are default. The category must contain the selected prompt name for that prompt’s text to be included. Minimum and maximum values do not apply to this dropdown.
prompt_1_name
An optional prompt-name dropdown for the first selected prompt. Its options are gathered from names across all categories in your prompts.json database, and its default is the first name in the resulting list. If no names are available, the fallback option and default are new prompt. A name appearing in this dropdown is not necessarily present in the category you selected; only a matching category-and-name pair contributes text. Minimum and maximum values do not apply to this dropdown.
prompt_1_enabled
An optional BOOLEAN that controls whether the first selected prompt can contribute to the result. Its default is true. When set to false, that prompt is skipped even if its category and name match a saved entry. Its options are true and false; numeric minimum and maximum values do not apply.
Prompt Stack Output Parameters:
stacked_prompts
A STRING containing the text of all enabled, successfully found prompts, joined with the chosen separator in ascending row-number order. It contains the saved prompt text, not the category or prompt names. If no entries qualify—for example, because they are disabled, missing, or unavailable in the database—the output is an empty string. The separator appears only between included prompts, not before the first or after the last.
Prompt Stack Usage Tips:
- Choose a category and a prompt name that belong together. The name dropdown draws from every category, but the lookup uses the specific category you selected.
- Use additional frontend-added
prompt_N_category,prompt_N_name, andprompt_N_enabledrows to combine more saved prompts. These are dynamic repeated rows, not additional fixed input parameters. Rows are processed by their numericNvalue, so their numbering determines the order of the output. - Turn off a row’s enabled setting to leave it out of the result without changing its category or name. Missing enabled values on dynamic rows are treated as enabled.
- Set
separatorto the punctuation or spacing you want between prompt pieces. For example, retain the default,for comma-separated phrases; use a newline when each saved prompt should begin on its own line. Check that your saved text and separator do not create unwanted duplicate punctuation. - Keep the saved entries in
prompts.jsoncurrent. PromptStack reads that file when it builds the output; changingpreview_textdoes not edit saved prompts or affect the result.
Prompt Stack Common Errors and Solutions:
Error creating prompts.json: <details>
- Explanation: The node attempted to create a missing
prompts.jsonfile from its default prompts, but file or folder creation failed. The text after the colon contains the underlying error. - Solution: Check that the prompt-database location exists or can be created and that the application has permission to write there. Use the underlying error details to identify issues such as a read-only folder or full disk.
Error loading categories for Prompt Stack INPUT_TYPES: <details>
- Explanation: The node could not load category and prompt-name options while building its interface. Possible causes include an unreadable or invalid
prompts.jsonfile. The interface then falls back todefaultandnew promptif it has no categories or names. - Solution: Check that
prompts.jsoncan be read and contains valid JSON organized as categories with prompt names beneath them. Correct the issue shown after the colon, then refresh the node interface.
Empty stacked_prompts output
- Explanation: This is a possible result, not a reported error message. The node returns an empty string when it finds no enabled rows with both a category and name matching nonempty saved prompt text. A missing or unreadable database during execution can also leave it with no text to combine; that read failure is not reported by this function.
- Solution: Confirm that at least one row is enabled, its category and name match an entry in
prompts.json, and that entry contains text. Also check that the database file exists and contains valid JSON.
Selected prompt name produces no text
- Explanation: This is a possible symptom, not a reported error message. The name dropdown includes names from all categories, so a visible name may not exist under the currently selected category. The node skips that combination without reporting an error.
- Solution: Select the category containing that name, or choose a prompt name saved under your current category.
