{"record":{"id":"ebbc3a11c5023989","repo":"siyuan-note/siyuan","slug":"invalid-color-s","errorCode":null,"errorMessage":"invalid color [%s]","messagePattern":"invalid color \\[(.+?)\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/boot_appearance.go","lineNumber":735,"sourceCode":"\t\t\tcontinue\n\t\t}\n\t\tif !seen[normalized] {\n\t\t\tseen[normalized] = true\n\t\t\tfrontends = append(frontends, normalized)\n\t\t}\n\t}\n\tif len(frontends) == 0 && len(manifestFrontends) == 0 && len(pluginFrontends) == 0 {\n\t\tfrontends = append(frontends, \"desktop\", \"mobile\")\n\t}\n\tif len(frontends) == 0 {\n\t\treturn nil, errors.New(\"no supported frontend\")\n\t}\n\treturn frontends, nil\n}\n\nfunc validateOptionalBootAppearanceColor(color string) error {\n\tif color != \"\" && !bootAppearanceColorPattern.MatchString(color) {\n\t\treturn fmt.Errorf(\"invalid color [%s]\", color)\n\t}\n\treturn nil\n}\n\nfunc isValidBootAppearanceID(id string) bool {\n\treturn len(id) <= 64 && bootAppearanceIDPattern.MatchString(id)\n}\n\nfunc isSafeBootAppearanceRelativePath(relativePath string) bool {\n\tif relativePath == \"\" || len(relativePath) > maxBootAppearancePathLength || strings.Contains(relativePath, \"\\\\\") ||\n\t\tstrings.ContainsAny(relativePath, `<>:\"|?*`) || strings.HasPrefix(relativePath, \"/\") ||\n\t\tfilepath.IsAbs(relativePath) || filepath.VolumeName(relativePath) != \"\" {\n\t\treturn false\n\t}\n\tsegments := strings.Split(relativePath, \"/\")\n\tif len(segments) > maxBootAppearancePathDepth {\n\t\treturn false\n\t}","sourceCodeStart":717,"sourceCodeEnd":753,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/boot_appearance.go#L717-L753","documentation":"Thrown by validateOptionalBootAppearanceColor when a color field is non-empty but does not match bootAppearanceColorPattern, a hex color of 3, 4, 6, or 8 hex digits prefixed by '#'. Empty means unset and is allowed; anything else must be valid hex (no rgb(), names, or uppercase-invalid formats).","triggerScenarios":"A manifest color like \"red\", \"rgb(255,0,0)\", \"#GGGGGG\", or \"ffffff\" (missing '#') encountered during loadBootAppearance.","commonSituations":"Authors using CSS color names or functional notations, dropping the '#' prefix, or exporting colors with alpha as \"#11223344;0.5\" style strings.","solutions":["Convert the value to hex notation: #RGB, #RGBA, #RRGGBB, or #RRGGBBAA (e.g. rgb(255,0,0) -> #ff0000).","Add the missing '#' prefix if it was omitted.","Remove the field to accept the default styling."],"exampleFix":"// before\n\"color\": \"rgb(20, 30, 40)\"\n// after\n\"color\": \"#141e28\"","handlingStrategy":"validation","validationCode":"function validOptionalColor(c) { return !c || /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(c); }","typeGuard":"const isHexColor = (v) => typeof v === \"string\" && /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(v);","tryCatchPattern":"try { await installBootAppearance(pkg); } catch (e) { if (String(e).includes(\"invalid color\")) { /* convert the color to hex notation */ } else throw e; }","preventionTips":["Use hex notation only (#RGB/#RGBA/#RRGGBB/#RRGGBBAA)","Never use CSS color names or rgb() in manifests","Omit the field if default styling is acceptable"],"tags":["validation","manifest","color"],"backgroundTag":"invalid-argument-format","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}