{"record":{"id":"bb7ad4f428028323","repo":"invoke-ai/InvokeAI","slug":"unsupported-reference-illuminant-reference-illum","errorCode":null,"errorMessage":"Unsupported reference_illuminant: {reference_illuminant}","messagePattern":"Unsupported reference_illuminant: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/image_util/color_conversion.py","lineNumber":63,"sourceCode":"    (1.0, -0.0894841775, -1.2914855480),\n)\n_LMS_TO_LINEAR_SRGB_MATRIX = (\n    (4.0767416621, -3.3077115913, 0.2309699292),\n    (-1.2684380046, 2.6097574011, -0.3413193965),\n    (-0.0041960863, -0.7034186147, 1.7076147010),\n)\n\n\ndef _require_color_tensor(color_tensor: torch.Tensor) -> torch.Tensor:\n    if color_tensor.ndim != 3 or color_tensor.shape[0] != 3:\n        raise ValueError(\"color_tensor must be a 3xHxW tensor\")\n    return color_tensor\n\n\ndef _require_reference_illuminant(reference_illuminant: str) -> str:\n    normalized = reference_illuminant.upper()\n    if normalized not in _REFERENCE_ILLUMINANTS:\n        raise ValueError(f\"Unsupported reference_illuminant: {reference_illuminant}\")\n    return normalized\n\n\ndef _full_like_spatial(reference_tensor: torch.Tensor, fill_value: float) -> torch.Tensor:\n    return torch.full(\n        reference_tensor.shape[1:], fill_value, dtype=reference_tensor.dtype, device=reference_tensor.device\n    )\n\n\ndef _degrees_from_unit_hue(unit_hue_tensor: torch.Tensor) -> torch.Tensor:\n    return torch.remainder(unit_hue_tensor * 360.0, 360.0)\n\n\ndef _unit_hue_from_degrees(hue_tensor: torch.Tensor) -> torch.Tensor:\n    return torch.remainder(hue_tensor, 360.0) / 360.0\n\n\ndef _matrix_tensor(matrix: tuple[tuple[float, ...], ...], reference_tensor: torch.Tensor) -> torch.Tensor:","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/image_util/color_conversion.py#L45-L81","documentation":"_require_reference_illuminant validates the white-point identifier (e.g. 'D65') against the known _REFERENCE_ILLUMINANTS set and normalizes it to uppercase; unknown names cannot be mapped to a chromaticity.","triggerScenarios":"Calling lab_from_xyz, xyz_from_lab, or _adapt_xyz-dependent helpers with reference_illuminant like 'd65 ' (unnormalized usage), 'D50 ' typo, or a name not in the supported set.","commonSituations":"Copy-pasting illuminant names from other libraries with different spellings (e.g. 'D65/2°'), lowercase/whitespace variants when calling outside the guard, assuming arbitrary illuminants are supported.","solutions":["Use a supported illuminant name such as 'D65' (check _REFERENCE_ILLUMINANTS for the exact set)","Pass the name in any case — it is uppercased internally — but fix spelling/whitespace","Pick the closest supported illuminant and adapt your data accordingly"],"exampleFix":"// before\nxyz_from_lab(lab, reference_illuminant=\"d60\")\n// after\nxyz_from_lab(lab, reference_illuminant=\"D65\")","handlingStrategy":"validation","validationCode":"from invokeai.backend.image_util.color_conversion import _REFERENCE_ILLUMINANTS\nif illuminant.upper() not in _REFERENCE_ILLUMINANTS:\n    illuminant = \"D65\"  # safe default","typeGuard":"def is_supported_illuminant(name: str, valid=frozenset({'D65','D50'})) -> bool:\n    return name.upper() in valid","tryCatchPattern":"try:\n    xyz = xyz_from_lab(lab, reference_illuminant=illuminant)\nexcept ValueError as e:\n    if \"Unsupported reference_illuminant\" in str(e):\n        xyz = xyz_from_lab(lab, reference_illuminant=\"D65\")\n    else:\n        raise","preventionTips":["Use string-literal constants from the supported set, not free-form config","Default to D65 unless the data source specifies otherwise","Normalize case/whitespace when illuminant names come from user config"],"tags":["validation","color-space","unsupported-value"],"backgroundTag":"invalid-enum-value","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}