{"record":{"id":"07e205763dbfa329","repo":"glanceapp/glance","slug":"hsl-lightness-must-be-between-0-and-d","errorCode":null,"errorMessage":"HSL lightness must be between 0 and %d","messagePattern":"HSL lightness must be between 0 and (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/glance/config-fields.go","lineNumber":86,"sourceCode":"\t\treturn fmt.Errorf(\"HSL hue must be between 0 and %d\", hslHueMax)\n\t}\n\n\tsaturation, err := strconv.ParseFloat(matches[2], 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif saturation > hslSaturationMax {\n\t\treturn fmt.Errorf(\"HSL saturation must be between 0 and %d\", hslSaturationMax)\n\t}\n\n\tlightness, err := strconv.ParseFloat(matches[3], 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif lightness > hslLightnessMax {\n\t\treturn fmt.Errorf(\"HSL lightness must be between 0 and %d\", hslLightnessMax)\n\t}\n\n\tc.H = hue\n\tc.S = saturation\n\tc.L = lightness\n\n\treturn nil\n}\n\nvar durationFieldPattern = regexp.MustCompile(`^(\\d+)(s|m|h|d)$`)\n\ntype durationField time.Duration\n\nfunc (d *durationField) UnmarshalYAML(node *yaml.Node) error {\n\tvar value string\n\n\tif err := node.Decode(&value); err != nil {\n\t\treturn err","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/glanceapp/glance/blob/91324e8de762702e97b0ac5c8e36271d644d8642/internal/glance/config-fields.go#L68-L104","documentation":"Returned by hslColorField.UnmarshalYAML when the lightness component of an HSL color string exceeds hslLightnessMax (100) after parsing as float. Third and final range check in HSL color parsing; fires after pattern match and successful float parse of matches[3].","triggerScenarios":"An HSL color such as `200 50% 120%` — lightness above 100%.","commonSituations":"Same as other range errors: values ported from different scales, typos, or copy-paste from tools that normalize differently.","solutions":["Keep lightness between 0% and 100%.","Fix typos in the third component.","Run `glance config:validate` to pinpoint the key."],"exampleFix":"# before\nprimary-color: 200 50% 120%\n\n# after\nprimary-color: 200 50% 45%","handlingStrategy":"validation","validationCode":"python3 -c \"\nimport re,sys\nhsl=re.compile(r'^(\\d+(?:\\.\\d+)?) (\\d+(?:\\.\\d+)?)% (\\d+(?:\\.\\d+)?)%$')\nm=hsl.match('200 50% 120%')\nsys.exit('lightness out of range' if m and float(m.group(3))>100 else 0)\n\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep lightness on the 0-100% scale.","Run a config lint for all three HSL components in CI."],"tags":["config","theme","color","range","validation"],"backgroundTag":null,"analyzedSha":"91324e8de762702e97b0ac5c8e36271d644d8642","analyzedAt":"2026-08-15T14:12:54.279Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}