nexu-io/open-design · error · SystemExit
invalid chroma key color: {value}; expected #RRGGBB
Error message
invalid chroma key color: {value}; expected #RRGGBB What it means
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.
Source
Thrown at skills/hatch-pet/scripts/extract_strip_frames.py:41
"waiting": 6,
"running": 6,
"review": 6,
}
def parse_states(raw: str) -> list[str]:
if raw.strip().lower() == "all":
return list(ROW_FRAME_COUNTS)
states = [item.strip() for item in raw.split(",") if item.strip()]
unknown = sorted(set(states) - set(ROW_FRAME_COUNTS))
if unknown:
raise SystemExit(f"unknown state(s): {', '.join(unknown)}")
return states
def parse_hex_color(value: str) -> tuple[int, int, int]:
if not re.fullmatch(r"#[0-9a-fA-F]{6}", value):
raise SystemExit(f"invalid chroma key color: {value}; expected #RRGGBB")
return tuple(int(value[index : index + 2], 16) for index in (1, 3, 5))
def load_chroma_key(decoded_dir: Path, override: str | None) -> tuple[int, int, int]:
if override:
return parse_hex_color(override)
request_path = decoded_dir.parent / "pet_request.json"
if request_path.is_file():
request = json.loads(request_path.read_text(encoding="utf-8"))
chroma_key = request.get("chroma_key")
if isinstance(chroma_key, dict) and isinstance(chroma_key.get("hex"), str):
return parse_hex_color(chroma_key["hex"])
return parse_hex_color("#00FF00")
def color_distance(
red: int,
green: int,View on GitHub (pinned to 5be4028344)
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.
Example fix
# before --chroma-key 0F0 # after --chroma-key #00FF00
Defensive patterns
Strategy: type-guard
Validate before calling
import re
def valid_hex(value: str) -> bool:
return bool(re.fullmatch(r"#[0-9a-fA-F]{6}", value))
assert valid_hex("#00FF00"), "chroma key must be #RRGGBB" Type guard
import re
def is_rrggbb(value: object) -> bool:
return isinstance(value, str) and bool(re.fullmatch(r"#[0-9a-fA-F]{6}", value)) Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Using a color name instead of hex; 3-digit CSS shorthand; forgetting the leading #; an upstream request builder writing the wrong format.
Related errors
- unknown state(s): {', '.join(unknown)}
- could not find {frame_count} sprite components in {strip_pat
- job {job_id} has no {field}
- invalid chroma key color: {value}; expected #RRGGBB
- reference not found: {source}
AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12).
Data as JSON: /api/errors/a1ceea267d68a524.
Report an issue: GitHub.