{"record":{"id":"08f0e4a20b664584","repo":"siyuan-note/siyuan","slug":"icon-s-not-exists-or-not-available","errorCode":null,"errorMessage":"icon [%s] not exists or not available","messagePattern":"icon \\[(.+?)\\] not exists or not available","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/appearance.go","lineNumber":76,"sourceCode":"\t\tConf.Appearance.ThemeLight = \"daylight\"\n\t\tConf.Appearance.ThemeJS = false\n\t}\n\tif !containIcon(Conf.Appearance.Icon, Conf.Appearance.Icons) {\n\t\tConf.Appearance.Icon = \"litheness\"\n\t}\n\tConf.m.Unlock()\n\n\tConf.Save()\n\n\tutil.InitEmojiChars()\n}\n\nfunc SetIcon(icon string) error {\n\tConf.m.Lock()\n\tdefer Conf.m.Unlock()\n\n\tif !containIcon(icon, Conf.Appearance.Icons) {\n\t\treturn fmt.Errorf(\"icon [%s] not exists or not available\", icon)\n\t}\n\tConf.Appearance.Icon = icon\n\treturn nil\n}\n\nfunc SetTheme(theme string, modes []int, appearanceMode string) error {\n\tConf.m.Lock()\n\tdefer Conf.m.Unlock()\n\n\tif theme != \"\" {\n\t\tfor _, mode := range modes {\n\t\t\tswitch mode {\n\t\t\tcase 0:\n\t\t\t\tif !containTheme(theme, Conf.Appearance.LightThemes) {\n\t\t\t\t\treturn fmt.Errorf(\"theme [%s] not exists or not available for light mode\", theme)\n\t\t\t\t}\n\t\t\t\tConf.Appearance.ThemeLight = theme\n\t\t\tcase 1:","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/model/appearance.go#L58-L94","documentation":"Returned by SetIcon when the requested icon name is not found in Conf.Appearance.Icons (the currently loaded/installed icon packs). Icons are populated by LoadIcons during InitAppearance; SetIcon compares by Name. Passing an icon that is not installed (or whose pack failed to load) is rejected before Conf.Appearance.Icon is mutated.","triggerScenarios":"Calling SetIcon with a name that does not match any AppearanceIcon.Name — e.g. an icon pack that was uninstalled, a typo, or an icon referenced before LoadIcons ran.","commonSituations":"A user uninstalls an icon pack but config still references its name; calling SetIcon during startup before InitAppearance has populated Icons; a typo or localized name vs the canonical Name.","solutions":["Install/keep the icon pack that provides the icon, then retry.","List Conf.Appearance.Icons and pick a Name that is actually present (e.g. the default \"litheness\").","Ensure SetIcon is only called after InitAppearance has loaded icons."],"exampleFix":"// before\nmodel.SetIcon(\"removed-pack\")\n// after\nmodel.SetIcon(\"litheness\")  // default, always present","handlingStrategy":"validation","validationCode":"if !containIcon(name, Conf.Appearance.Icons) {\n    return fmt.Errorf(\"icon %q not installed\", name)\n}","typeGuard":"func iconAvailable(name string, icons []*conf.AppearanceIcon) bool {\n    for _, i := range icons { if i.Name == name { return true } }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Call SetIcon only after InitAppearance has loaded icons.","Reference installed icon packs only; fall back to \"litheness\" if unsure.","Re-validate persisted icon names whenever an icon pack is uninstalled."],"tags":["appearance","icon","config","validation"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}