{"record":{"id":"3aaadfce108748e6","repo":"unslothai/unsloth","slug":"a-prompts-list-is-supported-for-plain-text-to-imag","errorCode":null,"errorMessage":"A prompts list is supported for plain text-to-image only; the {workflow} workflow takes one prompt per call (seed lists still work).","messagePattern":"A prompts list is supported for plain text-to-image only; the (.+?) workflow takes one prompt per call \\(seed lists still work\\)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":400,"severity":"error","filePath":"studio/backend/core/inference/diffusion.py","lineNumber":5457,"sourceCode":"                        src = decode_b64_image(cn_image_b64, mode = \"RGB\")\n                        control_pil = diffusion_controlnet.preprocess_control(src, cn_type).resize(\n                            (width, height), Image.LANCZOS\n                        )\n                        try:\n                            resolved_cn = diffusion_controlnet.resolve_controlnet(\n                                cn_id, family = state.family.name\n                            )\n                        except FileNotFoundError as exc:\n                            # An unknown CN id -> 400, not 500 (the route maps ValueError).\n                            raise ValueError(str(exc)) from exc\n                        pipe = self._controlnet_pipe(state, resolved_cn, cancel)\n                        workflow = \"controlnet\"\n                        cn_scale, cn_gstart, cn_gend = cn_strength, cn_gs, cn_ge\n                        # Flux Union CN selects its head by an integer control_mode; map the type.\n                        cn_mode = diffusion_controlnet.union_control_mode(cn_id, cn_type)\n                # A prompt LIST batches plain text-to-image only: conditioned workflows take one image per call and a silent broadcast would pair every prompt with it.\n                if uniform_prompt(jobs) is None and workflow != \"txt2img\":\n                    raise ValueError(\n                        \"A prompts list is supported for plain text-to-image only; the \"\n                        f\"{workflow} workflow takes one prompt per call (seed lists still work).\"\n                    )\n                # Snap odd-sized inputs (and the mask) to a multiple of 16 where the OUTPUT size comes from the input image.\n                if init_pil is not None and workflow in (\"img2img\", \"inpaint\", \"edit\"):\n                    # img2img/inpaint take output size from the upload, so bound the longest side to 2048 (a phone photo would OOM).\n                    if workflow == \"img2img\":\n                        # ...and bound Transform by the REQUESTED size too, so the Resolution\n                        # control caps the output instead of being inert. img2img only: an\n                        # inpaint payload is the canvas the mask was painted against (Extend\n                        # sends a deliberately ENLARGED one), so shrinking it would break them.\n                        init_pil = _fit_within(init_pil, min(2048, width), min(2048, height))\n                    elif workflow == \"inpaint\":\n                        init_pil = _clamp_max_side(init_pil, 2048)\n                    init_pil = _snap_to_multiple(init_pil, 16)\n                    if mask_pil is not None and mask_pil.size != init_pil.size:\n                        from PIL import Image as _PILImage\n                        mask_pil = mask_pil.resize(init_pil.size, _PILImage.NEAREST)","sourceCodeStart":5439,"sourceCodeEnd":5475,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/inference/diffusion.py#L5439-L5475","documentation":"A prompt list (batching multiple prompts in one call) only works for the plain txt2img workflow. Conditioned workflows (inpaint, img2img, edit, reference, controlnet, upscale) take exactly one prompt per call because they carry one conditioning image; accepting a list would silently broadcast the same image against every prompt. uniform_prompt(jobs) returning None means the prompts were not a single uniform value, so with any non-txt2img workflow the call is rejected.","triggerScenarios":"Calling generate with a list of prompts (non-uniform) together with init_image, mask_image, controlnet, or any other feature that selects a workflow other than txt2img. Note: seed lists remain allowed in conditioned workflows.","commonSituations":"Reusing a batch-generation payload (prompts: [...]) after attaching an init image for img2img; building a UI 'generate variations' feature that batches prompts while a reference/ControlNet image is active.","solutions":["Split the call: issue one request per prompt for the conditioned workflow (loop client-side).","Keep the prompt list only for plain txt2img (no init_image/mask/controlnet/reference).","Remember seeds lists still work with a single prompt in conditioned workflows — only the prompts list is restricted."],"exampleFix":"# before\nengine.generate(prompt=[\"a cat\", \"a dog\"], init_image=img)  # ValueError\n# after\nfor p in [\"a cat\", \"a dog\"]:\n    engine.generate(prompt=p, init_image=img, seed=base_seed + i)","handlingStrategy":"validation","validationCode":"def is_txt2img_request(payload: dict) -> bool:\n    return not (payload.get(\"init_image\") or payload.get(\"mask_image\") or payload.get(\"controlnet\"))\n\nif isinstance(payload.get(\"prompt\"), list) and not is_txt2img_request(payload):\n    raise UserError(\"Split the prompt list into one call per prompt for this workflow.\")","typeGuard":"def is_prompt_list(v) -> bool:\n    return isinstance(v, list)","tryCatchPattern":"try:\n    out = engine.generate(prompt=prompts, init_image=img)\nexcept ValueError as e:\n    if \"prompts list is supported for plain text-to-image only\" in str(e):\n        out = [engine.generate(prompt=p, init_image=img) for p in prompts]\n    else:\n        raise","preventionTips":["Loop one-prompt-per-call for any conditioned workflow; batch lists only for pure txt2img.","Remember seed lists stay valid with conditioned workflows — only prompt lists are restricted."],"tags":["diffusion","batching","validation","workflow"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}