{"record":{"id":"a1ceea267d68a524","repo":"nexu-io/open-design","slug":"invalid-chroma-key-color-value-expected-rrggb","errorCode":null,"errorMessage":"invalid chroma key color: {value}; expected #RRGGBB","messagePattern":"invalid chroma key color: (.+?); expected #RRGGBB","errorType":"exception","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"skills/hatch-pet/scripts/extract_strip_frames.py","lineNumber":41,"sourceCode":"    \"waiting\": 6,\n    \"running\": 6,\n    \"review\": 6,\n}\n\n\ndef parse_states(raw: str) -> list[str]:\n    if raw.strip().lower() == \"all\":\n        return list(ROW_FRAME_COUNTS)\n    states = [item.strip() for item in raw.split(\",\") if item.strip()]\n    unknown = sorted(set(states) - set(ROW_FRAME_COUNTS))\n    if unknown:\n        raise SystemExit(f\"unknown state(s): {', '.join(unknown)}\")\n    return states\n\n\ndef parse_hex_color(value: str) -> tuple[int, int, int]:\n    if not re.fullmatch(r\"#[0-9a-fA-F]{6}\", value):\n        raise SystemExit(f\"invalid chroma key color: {value}; expected #RRGGBB\")\n    return tuple(int(value[index : index + 2], 16) for index in (1, 3, 5))\n\n\ndef load_chroma_key(decoded_dir: Path, override: str | None) -> tuple[int, int, int]:\n    if override:\n        return parse_hex_color(override)\n    request_path = decoded_dir.parent / \"pet_request.json\"\n    if request_path.is_file():\n        request = json.loads(request_path.read_text(encoding=\"utf-8\"))\n        chroma_key = request.get(\"chroma_key\")\n        if isinstance(chroma_key, dict) and isinstance(chroma_key.get(\"hex\"), str):\n            return parse_hex_color(chroma_key[\"hex\"])\n    return parse_hex_color(\"#00FF00\")\n\n\ndef color_distance(\n    red: int,\n    green: int,","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/skills/hatch-pet/scripts/extract_strip_frames.py#L23-L59","documentation":"parse_hex_color requires a 6-digit hex string in #RRGGBB form (regex #[0-9a-fA-F]{6}). This applies both to --chroma-key overrides on the command line and to the chroma_key.hex value read from pet_request.json.","triggerScenarios":"Passing --chroma-key with a CSS color name (green), a 3-digit shorthand (#0F0), a missing hash (00FF00), or a wrong-length value (#1234567). Also fires when pet_request.json carries a malformed chroma_key.hex.","commonSituations":"Using a color name instead of hex; 3-digit CSS shorthand; forgetting the leading #; an upstream request builder writing the wrong format.","solutions":["Format the value as #RRGGBB, e.g. --chroma-key #00FF00.","If the value comes from pet_request.json, fix chroma_key.hex there.","Omit --chroma-key to fall back to the request value, or the default #00FF00 when the request lacks one."],"exampleFix":"# before\n--chroma-key 0F0\n# after\n--chroma-key #00FF00","handlingStrategy":"type-guard","validationCode":"import re\n\ndef valid_hex(value: str) -> bool:\n    return bool(re.fullmatch(r\"#[0-9a-fA-F]{6}\", value))\n\nassert valid_hex(\"#00FF00\"), \"chroma key must be #RRGGBB\"","typeGuard":"import re\n\ndef is_rrggbb(value: object) -> bool:\n    return isinstance(value, str) and bool(re.fullmatch(r\"#[0-9a-fA-F]{6}\", value))","tryCatchPattern":null,"preventionTips":["Always include the leading # and use 6 hex digits.","If reading chroma_key.hex from pet_request.json, validate it at request-build time.","Omit --chroma-key to use the request/default value when unsure."],"tags":["hatch-pet","chroma-key","validation","cli-args"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}