{"record":{"id":"36426287ae559dfa","repo":"bevyengine/bevy","slug":"invalid-hex-char","errorCode":null,"errorMessage":"Invalid hex char","messagePattern":"Invalid hex char","errorType":"validation","errorClass":"HexColorError","httpStatus":null,"severity":"error","filePath":"crates/bevy_color/src/srgba.rs","lineNumber":442,"sourceCode":"            r: color.red as f64,\n            g: color.green as f64,\n            b: color.blue as f64,\n            a: color.alpha as f64,\n        }\n    }\n}\n\n/// Error returned if a hex string could not be parsed as a color.\n#[derive(Debug, Error, PartialEq, Eq)]\npub enum HexColorError {\n    /// Parsing error.\n    #[error(\"Invalid hex string\")]\n    Parse(#[from] core::num::ParseIntError),\n    /// Invalid length.\n    #[error(\"Unexpected length of hex string\")]\n    Length,\n    /// Invalid character.\n    #[error(\"Invalid hex char\")]\n    Char(char),\n}\n\n#[cfg(test)]\nmod tests {\n    use crate::testing::assert_approx_eq;\n\n    use super::*;\n\n    #[test]\n    fn test_to_from_linear() {\n        let srgba = Srgba::new(0.0, 0.5, 1.0, 1.0);\n        let linear_rgba: LinearRgba = srgba.into();\n        assert_eq!(linear_rgba.red, 0.0);\n        assert_approx_eq!(linear_rgba.green, 0.2140, 0.0001);\n        assert_approx_eq!(linear_rgba.blue, 1.0, 0.0001);\n        assert_eq!(linear_rgba.alpha, 1.0);\n        let srgba2: Srgba = linear_rgba.into();","sourceCodeStart":424,"sourceCodeEnd":460,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_color/src/srgba.rs#L424-L460","documentation":"HexColorError::Char: the string has a valid length but contains a character outside the hexadecimal alphabet at the position carried in the error, so u32::from_str_radix cannot parse the color channels.","triggerScenarios":"Thrown at crates/bevy_color/src/srgba.rs:442 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Replace the offending character with a hex digit (0-9, a-f)","Double-check color constants for typos like 'O' instead of '0'"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}