{"record":{"id":"1f5b303eb0a46292","repo":"sgl-project/sglang","slug":"prompt-cannot-be-empty-1f5b30","errorCode":null,"errorMessage":"Prompt cannot be empty","messagePattern":"Prompt cannot be empty","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/apps/ComfyUI_SGLDiffusion/nodes.py","lineNumber":351,"sourceCode":"    CATEGORY = \"SGLDiffusion\"\n    OUTPUT_NODE = False\n\n    def generate_image(\n        self,\n        sgld_client: SGLDiffusionServerAPI,\n        positive_prompt: str,\n        negative_prompt: str = \"\",\n        image: torch.Tensor = None,\n        seed: int = 1024,\n        steps: int = 6,\n        cfg: float = 7.0,\n        width: int = 1024,\n        height: int = 1024,\n        enable_teacache: bool = False,\n    ):\n        \"\"\"Generate image using SGLang Diffusion API.\"\"\"\n        if not positive_prompt:\n            raise ValueError(\"Prompt cannot be empty\")\n\n        size = f\"{width}x{height}\"\n\n        # Prepare request parameters\n        request_params = {\n            \"prompt\": positive_prompt,\n            \"size\": size,\n            \"response_format\": \"b64_json\",\n        }\n\n        # Add optional parameters if provided\n        if negative_prompt:\n            request_params[\"negative_prompt\"] = negative_prompt\n        if cfg is not None:\n            request_params[\"guidance_scale\"] = cfg\n        if steps is not None:\n            request_params[\"num_inference_steps\"] = steps\n        if seed is not None and seed >= 0:","sourceCodeStart":333,"sourceCodeEnd":369,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/apps/ComfyUI_SGLDiffusion/nodes.py#L333-L369","documentation":"ValueError raised by the ComfyUI SGLDiffusionGenerateImage node before any request is sent: positive_prompt is empty. It is a client-side precondition so users get a clear ComfyUI error instead of a server round-trip.","triggerScenarios":"Executing the ComfyUI node with an empty/unconnected positive prompt text field.","commonSituations":"Text encode node not wired into the generator; empty STRING widget; workflow templating that clears prompts.","solutions":["Type a prompt into the text node or connect a CLIPTextEncode output to the positive input.","Check for stray whitespace-only strings.","If intentional blank generation is needed, supply a placeholder prompt."],"exampleFix":"// before\n# ComfyUI: positive prompt widget left empty\n// after\npositive_prompt = positive_prompt.strip() or \"a scenic landscape, ultra detailed\"","handlingStrategy":"validation","validationCode":"if not positive_prompt or not positive_prompt.strip():\n    raise ValueError('positive prompt required')","typeGuard":"def node_has_prompt(s: str | None) -> bool:\n    return isinstance(s, str) and bool(s.strip())","tryCatchPattern":null,"preventionTips":["Wire the text encode node before queueing workflows.","Highlight empty prompt fields in workflow validation.","Provide default prompts in template workflows."],"tags":["validation","comfyui","empty-prompt","image-generation"],"backgroundTag":"empty-required-parameter","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}