{"record":{"id":"6d078e1bb2fb9075","repo":"Comfy-Org/ComfyUI","slug":"at-least-one-of-prompt-or-reference-image-must","errorCode":null,"errorMessage":"At least one of 'prompt' or 'reference_image' must be provided.","messagePattern":"At least one of 'prompt' or 'reference_image' must be provided\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_beeble.py","lineNumber":36,"sourceCode":"    downscale_video_to_max_pixels,\n    poll_op,\n    sync_op,\n    upload_image_to_comfyapi,\n    upload_video_to_comfyapi,\n    validate_string,\n    validate_video_frame_count,\n)\n\n_MAX_PIXELS = 2_770_000\n_MAX_FRAMES = 240\n_MAX_PROMPT_LEN = 2000\n\n\ndef _validate_inputs(prompt: str | None, reference_image: Input.Image | None) -> str | None:\n    \"\"\"Beeble requires at least one of prompt or reference_image. Returns the cleaned prompt.\"\"\"\n    cleaned = prompt.strip() if prompt else \"\"\n    if not cleaned and reference_image is None:\n        raise ValueError(\"At least one of 'prompt' or 'reference_image' must be provided.\")\n    if cleaned:\n        validate_string(cleaned, strip_whitespace=False, max_length=_MAX_PROMPT_LEN)\n    return cleaned or None\n\n\nasync def _upload_mask_as_image(\n    cls: type[IO.ComfyNode],\n    mask: Input.Image,\n    *,\n    wait_label: str,\n) -> str:\n    \"\"\"Encode a single-frame MASK (H, W) or (1, H, W) as a PNG and upload.\"\"\"\n    if mask.dim() == 2:\n        mask = mask.unsqueeze(0)\n    image = convert_mask_to_image(mask[:1])\n    return await upload_image_to_comfyapi(\n        cls,\n        image,","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_beeble.py#L18-L54","documentation":"The Beeble switchX API requires at least one content input: a text prompt or a reference image. The node strips the prompt and raises this ValueError only when the cleaned prompt is empty AND reference_image is None, so whitespace-only prompts also trigger it.","triggerScenarios":"Invoking the Beeble node with prompt unset, empty, or whitespace-only while reference_image is not connected.","commonSituations":"Empty-string widget defaults flowing from templates; conditional workflows where the prompt upstream node produced ''; UI sending an unedited blank prompt field.","solutions":["Provide a non-empty prompt (after stripping) or connect a reference_image.","If the prompt comes from an upstream node, add a default/fallback so it is never blank.","Trim accidental whitespace-only strings before wiring them in."],"exampleFix":"# before\nbeeble_node(prompt=\"   \", reference_image=None)  # ValueError\n\n# after\nbeeble_node(prompt=prompt.strip() or \"enhance this photo\", reference_image=ref_img)","handlingStrategy":"validation","validationCode":"cleaned = (prompt or \"\").strip()\nif not cleaned and reference_image is None:\n    raise ValueError(\"provide prompt or reference_image\")  # fail early, before node","typeGuard":"def beeble_inputs_valid(prompt: str | None, ref) -> bool:\n    return bool((prompt or \"\").strip()) or ref is not None","tryCatchPattern":"try:\n    out = await beeble_node(prompt=prompt, reference_image=ref)\nexcept ValueError as e:\n    if \"must be provided\" in str(e):\n        out = await beeble_node(prompt=default_prompt, reference_image=ref)","preventionTips":["Default prompt widgets to a non-empty string.","Strip and assert prompts before wiring into the node.","Connect a reference image in prompt-less retouch workflows."],"tags":["beeble","input-validation","prompt","required-field"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}