Comfy-Org/ComfyUI · error · RuntimeError

ByteDance request failed. Code: {response.error['code']}, me

Error message

ByteDance request failed. Code: {response.error['code']}, message: {response.error['message']}

What it means

ByteDance image tasks return an error object inside an otherwise-HTTP-200 response. get_image_url_from_response checks response.error and re-raises it as RuntimeError with the API's code and message, after logging it at info level.

Source

Thrown at comfy_api_nodes/nodes_bytedance.py:427

def _seedance2_price_extractor(model_id: str, has_video_input: bool, resolution: str):
    """Returns a price_extractor closure for Seedance 2.0 poll_op."""
    rate = seedance2_price_per_1k_tokens(model_id, has_video_input, resolution)
    if rate is None:
        return None

    def extractor(response: TaskStatusResponse) -> float | None:
        if response.usage is None:
            return None
        return response.usage.total_tokens * 1.43 * rate / 1_000.0

    return extractor


def get_image_url_from_response(response: ImageTaskCreationResponse) -> str:
    if response.error:
        error_msg = f"ByteDance request failed. Code: {response.error['code']}, message: {response.error['message']}"
        logging.info(error_msg)
        raise RuntimeError(error_msg)
    logging.info("ByteDance task succeeded, image URL: %s", response.data[0]["url"])
    return response.data[0]["url"]


class ByteDanceImageNode(IO.ComfyNode):

    @classmethod
    def define_schema(cls):
        return IO.Schema(
            node_id="ByteDanceImageNode",
            display_name="ByteDance Image",
            category="partner/image/ByteDance",
            description="Generate images using ByteDance models via api based on prompt",
            inputs=[
                IO.Combo.Input("model", options=["seedream-3-0-t2i-250415"]),
                IO.String.Input(
                    "prompt",
                    multiline=True,

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Read the code/message pair: content-policy rejections need a prompt change; quota errors need billing/credits.
  2. Fix the parameter the code points at (size, seed range, model id).
  3. Transient codes can be handled by re-queueing the workflow once.
Defensive patterns

Strategy: try-catch

Try / catch

try:
    url = get_image_url_from_response(response)
except RuntimeError as e:
    code = parse_code(str(e))
    if code in TRANSIENT_CODES:
        response = await recreate_task(...)  # single retry
    else:
        raise  # moderation/quota errors need human action

Prevention

When it happens

Trigger: Any ByteDanceImageNode task whose ImageTaskCreationResponse carries a non-null error - invalid prompt (moderation), quota exhausted, invalid parameters, or content policy rejection.

Common situations: Prompt trips content moderation; account out of credits; model name or size string rejected by the API; transient upstream failure during task creation.

Related errors


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