{"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":"exception","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/9f775e8a12daef8255556097396f9b2739078892/kernel/model/appearance.go#L58-L94","documentation":"SetIcon validates the requested icon name against the list of discovered, currently available icons (containIcon over Conf.Appearance.Icons). If the name is absent or the icon package is not installed/available, the kernel rejects the change and returns this error; the current icon is left unchanged.","triggerScenarios":"Calling the icon-setting API (e.g. /api/setting/setAppearance icon parameter) with an icon name that is not installed in the appearance/icons directory or is disabled/unavailable.","commonSituations":"Typo in the icon package name; icon theme was deleted or not synced to the new machine; plugin/automation script sets an icon from another installation; icon exists on disk but is not registered (missing in available list).","solutions":["Check the exact icon name against the installed icons (Settings - Appearance - Icon) and correct the spelling","Install or re-download the icon package into app/appearance/icons (or via marketplace) before setting it","Query the current available icons via the appearance config and pick one of those names","Remove the stale icon reference from configuration if the icon was intentionally removed"],"exampleFix":"// before\nSetIcon(\"myCustomIcon\") // not installed\n// after\nSetIcon(\"litheness\") // an installed, available icon package","handlingStrategy":"validation","validationCode":"const icons = await fetchPost(\"/api/setting/getAppearance\", {}).icons || [];\nif (!icons.some(i => i.name === requestedIcon)) throw new Error(`icon ${requestedIcon} not installed`);","typeGuard":null,"tryCatchPattern":"try {\n  await setIcon(name);\n} catch (e) {\n  if (String(e).includes(\"not exists or not available\")) {\n    // fall back to a known-installed icon, e.g. \"litheness\"\n  }\n}","preventionTips":["Always pick icon names from the getAppearance response instead of hard-coding","Install the icon package before referencing it","Guard against workspace moves that leave icon packages behind","Centralize icon names in one config constant, verified at startup"],"tags":["appearance","icon","invalid-value","config"],"backgroundTag":"resource-not-found","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"}