Comfy-Org/ComfyUI · error · ValueError

Positive prompt is empty

Error message

Positive prompt is empty

What it means

Raised by validate_prompts when the positive prompt is empty (falsy) before the Kling request is sent. This is a client-side pre-flight check: Kling requires a non-empty positive prompt, so the node refuses to make the call. It fires before any network traffic.

Source

Thrown at comfy_api_nodes/nodes_kling.py:284

        and response.data.task_result.videos is not None
        and len(response.data.task_result.videos) > 0
    )


def is_valid_image_response(response: KlingImageGenerationsResponse) -> bool:
    """Verifies that the response contains a task result with at least one image."""
    return (
        response.data is not None
        and response.data.task_result is not None
        and response.data.task_result.images is not None
        and len(response.data.task_result.images) > 0
    )


def validate_prompts(prompt: str, negative_prompt: str, max_length: int) -> bool:
    """Verifies that the positive prompt is not empty and that neither promt is too long."""
    if not prompt:
        raise ValueError("Positive prompt is empty")
    if len(prompt) > max_length:
        raise ValueError(f"Positive prompt is too long: {len(prompt)} characters")
    if negative_prompt and len(negative_prompt) > max_length:
        raise ValueError(
            f"Negative prompt is too long: {len(negative_prompt)} characters"
        )
    return True


def validate_task_creation_response(response) -> None:
    """Validates that the Kling task creation request was successful."""
    if not is_valid_task_creation_response(response):
        error_msg = f"Kling initial request failed. Code: {response.code}, Message: {response.message}, Data: {response.data}"
        logging.error(error_msg)
        raise Exception(error_msg)


def validate_video_result_response(response) -> None:

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Provide a non-empty prompt string to the node's prompt input
  2. Check the workflow graph: confirm the node feeding the prompt actually outputs text
  3. If building prompts dynamically, guard with a default or skip when the composed prompt is blank

Example fix

// before
prompt = ""  # unconnected or empty upstream

// after
prompt = prompt or "a cinematic drone shot of a coastal city at sunset"
Defensive patterns

Strategy: validation

Validate before calling

def check_prompt(prompt: str) -> None:
    if not prompt or not prompt.strip():
        raise ValueError("prompt must be a non-empty string")

check_prompt(prompt)

Type guard

def has_valid_prompt(prompt) -> bool:
    return isinstance(prompt, str) and len(prompt.strip()) > 0

Try / catch

try:
    out = await kling_node(prompt=prompt, ...)
except ValueError as e:
    if "Positive prompt is empty" in str(e):
        out = await kling_node(prompt=DEFAULT_PROMPT, ...)
    else:
        raise

Prevention

When it happens

Trigger: Calling a Kling text-to-video/image node with prompt='' or a prompt that is None — e.g. an unconnected prompt input in the workflow, or an upstream node producing an empty string.

Common situations: Workflow wiring mistake where the prompt node output isn't connected; a template/concat node emitting empty text; programmatic API runs passing an empty string.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/7fc6b6e29ef5ac38. Report an issue: GitHub.