{"record":{"id":"5f92274f196e18f2","repo":"Comfy-Org/ComfyUI","slug":"background-color-must-be-a-hex-color-code-like-0","errorCode":null,"errorMessage":"background_color must be a hex color code like '#00ff00'.","messagePattern":"background_color must be a hex color code like '#00ff00'\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_heygen.py","lineNumber":451,"sourceCode":"        resolution: str = \"1080p\",\n        aspect_ratio: str = \"auto\",\n        background_color: str = \"\",\n        seed: int = 0,\n    ) -> IO.NodeOutput:\n        avatar_id, engine_type = await _resolve_avatar(cls, engine[\"avatar\"], custom_avatar_id, engine[\"engine\"])\n        payload = {\n            \"type\": \"avatar\",\n            \"avatar_id\": avatar_id,\n            \"resolution\": resolution,\n            \"aspect_ratio\": aspect_ratio,\n            \"title\": \"ComfyUI Avatar Video\",\n        }\n        if engine_type:\n            payload[\"engine\"] = {\"type\": engine_type}\n        background_color = background_color.strip()\n        if background_color:\n            if not background_color.startswith(\"#\"):\n                raise ValueError(\"background_color must be a hex color code like '#00ff00'.\")\n            payload[\"background\"] = {\"type\": \"color\", \"value\": background_color}\n        await _apply_speech_source(cls, payload, speech, require_voice=False)\n        video = await _create_and_poll_video(cls, payload)\n        return IO.NodeOutput(await download_url_to_video_output(video[\"video_url\"]))\n\n\nclass HeyGenCreateAvatarNode(IO.ComfyNode):\n    \"\"\"Create a reusable HeyGen avatar from a photo or a text prompt.\"\"\"\n\n    @classmethod\n    def define_schema(cls) -> IO.Schema:\n        return IO.Schema(\n            node_id=\"HeyGenCreateAvatarNode\",\n            display_name=\"HeyGen Create Avatar\",\n            category=\"partner/video/HeyGen\",\n            description=\"Create your own reusable HeyGen avatar from a photo of a person or \"\n            \"from a text prompt (a generated character). Feed the resulting avatar_id into \"\n            \"HeyGen Avatar Video's custom_avatar_id — and save the ID somewhere to reuse the \"","sourceCodeStart":433,"sourceCodeEnd":469,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_heygen.py#L433-L469","documentation":"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'].","triggerScenarios":"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.","commonSituations":"Users accustomed to CSS color names or 0x-prefixed hex copy values from design tools that omit the '#'.","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"],"exampleFix":"# before\nbackground_color = \"00ff00\"\n# after\nbackground_color = \"#00ff00\"","handlingStrategy":"validation","validationCode":"def bg_color_ok(background_color: str) -> bool:\n    v = background_color.strip()\n    return v == '' or (v.startswith('#') and len(v) == 7)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use '#rrggbb' exclusively in the background_color widget","Copy colors from a hex picker that includes the '#'"],"tags":["heygen","background-color","hex-format","input-validation"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}