{"record":{"id":"23f2188b42b402d7","repo":"AUTOMATIC1111/stable-diffusion-webui","slug":"unknown-variations-delimiter-variations-delimiter","errorCode":null,"errorMessage":"Unknown variations delimiter {variations_delimiter}","messagePattern":"Unknown variations delimiter (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scripts/prompt_matrix.py","lineNumber":65,"sourceCode":"            with gr.Column():\r\n                put_at_start = gr.Checkbox(label='Put variable parts at start of prompt', value=False, elem_id=self.elem_id(\"put_at_start\"))\r\n                different_seeds = gr.Checkbox(label='Use different seed for each picture', value=False, elem_id=self.elem_id(\"different_seeds\"))\r\n            with gr.Column():\r\n                prompt_type = gr.Radio([\"positive\", \"negative\"], label=\"Select prompt\", elem_id=self.elem_id(\"prompt_type\"), value=\"positive\")\r\n                variations_delimiter = gr.Radio([\"comma\", \"space\"], label=\"Select joining char\", elem_id=self.elem_id(\"variations_delimiter\"), value=\"comma\")\r\n            with gr.Column():\r\n                margin_size = gr.Slider(label=\"Grid margins (px)\", minimum=0, maximum=500, value=0, step=2, elem_id=self.elem_id(\"margin_size\"))\r\n\r\n        return [put_at_start, different_seeds, prompt_type, variations_delimiter, margin_size]\r\n\r\n    def run(self, p, put_at_start, different_seeds, prompt_type, variations_delimiter, margin_size):\r\n        modules.processing.fix_seed(p)\r\n        # Raise error if promp type is not positive or negative\r\n        if prompt_type not in [\"positive\", \"negative\"]:\r\n            raise ValueError(f\"Unknown prompt type {prompt_type}\")\r\n        # Raise error if variations delimiter is not comma or space\r\n        if variations_delimiter not in [\"comma\", \"space\"]:\r\n            raise ValueError(f\"Unknown variations delimiter {variations_delimiter}\")\r\n\r\n        prompt = p.prompt if prompt_type == \"positive\" else p.negative_prompt\r\n        original_prompt = prompt[0] if type(prompt) == list else prompt\r\n        positive_prompt = p.prompt[0] if type(p.prompt) == list else p.prompt\r\n\r\n        delimiter = \", \" if variations_delimiter == \"comma\" else \" \"\r\n\r\n        all_prompts = []\r\n        prompt_matrix_parts = original_prompt.split(\"|\")\r\n        combination_count = 2 ** (len(prompt_matrix_parts) - 1)\r\n        for combination_num in range(combination_count):\r\n            selected_prompts = [text.strip().strip(',') for n, text in enumerate(prompt_matrix_parts[1:]) if combination_num & (1 << n)]\r\n\r\n            if put_at_start:\r\n                selected_prompts = selected_prompts + [prompt_matrix_parts[0]]\r\n            else:\r\n                selected_prompts = [prompt_matrix_parts[0]] + selected_prompts\r\n\r","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/82a973c04367123ae98bd9abdf80d9eda9b910e2/scripts/prompt_matrix.py#L47-L83","documentation":"Companion check in Prompt Matrix run(): variations_delimiter must be exactly 'comma' or 'space' (the ui() Radio choices). The delimiter decides whether generated prompt-matrix variations are joined with ', ' or ' ', and anything else would silently change semantics, so it fails fast.","triggerScenarios":"API payload script args where the delimiter slot holds an unexpected string ('Comma', ',', ' '), usually because positional args are shifted by one, or a client hardcoding ',' instead of the enum word.","commonSituations":"Positional-arg misalignment in /sdapi/v1 alwayson_scripts args; clients written against a different script version whose arg list gained/lost a parameter.","solutions":["Use exactly 'comma' or 'space' in the delimiter slot","Verify the full 5-element arg order [put_at_start, different_seeds, prompt_type, variations_delimiter, margin_size] against the script's ui()","Add a client-side whitelist check before submitting the job"],"exampleFix":"# before\nargs = [False, False, 'positive', ',', 0]\n# after\nargs = [False, False, 'positive', 'comma', 0]","handlingStrategy":"type-guard","validationCode":"ALLOWED_DELIMITERS = {'comma', 'space'}\ndef delimiter_valid(d) -> bool:\n    return d in ALLOWED_DELIMITERS","typeGuard":"def is_delimiter(v) -> bool:\n    return v in ('comma', 'space')","tryCatchPattern":null,"preventionTips":["Use the enum words 'comma'/'space', not ',' or ' '","Pin the script arg order against the installed script's ui() signature","Validate all enum-like script args in one place before dispatch"],"tags":["script","prompt-matrix","api","validation","user-input"],"backgroundTag":null,"analyzedSha":"82a973c04367123ae98bd9abdf80d9eda9b910e2","analyzedAt":"2026-08-14T16:46:43.225Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}