Comfy-Org/ComfyUI · error · ValueError
background_color must be a hex color code like '#00ff00'.
Error message
background_color must be a hex color code like '#00ff00'.
What it means
Thrown by the HeyGen avatar video node when a non-empty background_color value does not start with '#'. HeyGen's background.color payload member expects a hex color string; the node only checks the '#' prefix (it does not fully validate the hex body) before building payload['background'].
Source
Thrown at comfy_api_nodes/nodes_heygen.py:451
resolution: str = "1080p",
aspect_ratio: str = "auto",
background_color: str = "",
seed: int = 0,
) -> IO.NodeOutput:
avatar_id, engine_type = await _resolve_avatar(cls, engine["avatar"], custom_avatar_id, engine["engine"])
payload = {
"type": "avatar",
"avatar_id": avatar_id,
"resolution": resolution,
"aspect_ratio": aspect_ratio,
"title": "ComfyUI Avatar Video",
}
if engine_type:
payload["engine"] = {"type": engine_type}
background_color = background_color.strip()
if background_color:
if not background_color.startswith("#"):
raise ValueError("background_color must be a hex color code like '#00ff00'.")
payload["background"] = {"type": "color", "value": background_color}
await _apply_speech_source(cls, payload, speech, require_voice=False)
video = await _create_and_poll_video(cls, payload)
return IO.NodeOutput(await download_url_to_video_output(video["video_url"]))
class HeyGenCreateAvatarNode(IO.ComfyNode):
"""Create a reusable HeyGen avatar from a photo or a text prompt."""
@classmethod
def define_schema(cls) -> IO.Schema:
return IO.Schema(
node_id="HeyGenCreateAvatarNode",
display_name="HeyGen Create Avatar",
category="partner/video/HeyGen",
description="Create your own reusable HeyGen avatar from a photo of a person or "
"from a text prompt (a generated character). Feed the resulting avatar_id into "
"HeyGen Avatar Video's custom_avatar_id — and save the ID somewhere to reuse the "View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Enter the color as '#rrggbb', e.g. '#00ff00'
- Leave background_color empty to keep the default background
- Note only the '#' prefix is enforced, but use full 6-digit hex to avoid HeyGen-side rejection
Example fix
# before background_color = "00ff00" # after background_color = "#00ff00"
Defensive patterns
Strategy: validation
Validate before calling
def bg_color_ok(background_color: str) -> bool:
v = background_color.strip()
return v == '' or (v.startswith('#') and len(v) == 7) Prevention
- Use '#rrggbb' exclusively in the background_color widget
- Copy colors from a hex picker that includes the '#'
When it happens
Trigger: Typing a color name ('green'), an 'rgb(...)' string, or a bare hex ('00ff00') without the leading '#' into the background_color widget while background type is color.
Common situations: Users accustomed to CSS color names or 0x-prefixed hex copy values from design tools that omit the '#'.
Related errors
- A voice is required when driving the video with a text scrip
- Avatar '{avatar_label}' does not support the {engine} engine
- HeyGen accepts at most 3 reference images; got {n_images}.
- Unsupported process_res_method: {method}
- At least 4 points are required to compute a homography.
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/5f92274f196e18f2.
Report an issue: GitHub.