{"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/9f775e8a12daef8255556097396f9b2739078892/kernel/model/boot_appearance.go#L717-L753","documentation":"validateOptionalBootAppearanceColor accepts an empty string (no color) or a string matching bootAppearanceColorPattern (a color syntax such as #RRGGBB). Any non-empty value that fails the pattern — wrong length, missing '#', invalid hex digits, or free text — aborts loading with this error naming the value.","triggerScenarios":"A boot appearance manifest whose optional color field (e.g. a background or accent color) is set to something like \"white\", \"fff\", \"#12345\", \"bg-white\", or contains spaces.","commonSituations":"Authors writing CSS color names instead of hex; omitting the leading '#'; using 4- or 8-digit shorthand the pattern does not accept; pasting values with trailing whitespace.","solutions":["Change the color value to a valid pattern-conforming form (e.g. \"#1E90FF\")","Remove the field entirely if you do not want to set a color (empty is allowed)","Verify the digit count and that only hexadecimal characters 0-9/A-F are used after the '#'"],"exampleFix":"// manifest.json before\n\"backgroundColor\": \"white\"\n// after\n\"backgroundColor\": \"#FFFFFF\"","handlingStrategy":"validation","validationCode":"function isValidColor(c) {\n  return c === \"\" || /^#[0-9A-Fa-f]{6}$/.test(c); // align with bootAppearanceColorPattern\n}","typeGuard":"function isHexColor(v) {\n  return typeof v === \"string\" && /^#[0-9A-Fa-f]{6}$/.test(v);\n}","tryCatchPattern":"try {\n  await loadManifest(pkgPath);\n} catch (e) {\n  const m = String(e).match(/invalid color \\[(.+)\\]/);\n  if (m) { /* replace m[1] with a valid hex color */ }\n}","preventionTips":["Use 6-digit hex with a leading '#' (e.g. #RRGGBB)","Do not use CSS color names like \"white\"","Omit optional color fields instead of leaving placeholders"],"tags":["boot-appearance","color","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}