{"record":{"id":"1656ad026990cc73","repo":"siyuan-note/siyuan","slug":"theme-s-not-exists-or-not-available-for-light-m","errorCode":null,"errorMessage":"theme [%s] not exists or not available for light mode","messagePattern":"theme \\[(.+?)\\] not exists or not available for light mode","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/appearance.go","lineNumber":91,"sourceCode":"\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:\n\t\t\t\tif !containTheme(theme, Conf.Appearance.DarkThemes) {\n\t\t\t\t\treturn fmt.Errorf(\"theme [%s] not exists or not available for dark mode\", theme)\n\t\t\t\t}\n\t\t\t\tConf.Appearance.ThemeDark = theme\n\t\t\t}\n\t\t}\n\t}\n\n\tif appearanceMode != \"\" {\n\t\tswitch appearanceMode {\n\t\tcase \"light\":\n\t\t\tConf.Appearance.ModeOS = false\n\t\t\tConf.Appearance.Mode = 0\n\t\tcase \"dark\":\n\t\t\tConf.Appearance.ModeOS = false","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/appearance.go#L73-L109","documentation":"SetTheme validates the theme name per requested mode. When mode 0 (light) is included and the theme is not in Conf.Appearance.LightThemes (installed themes usable in light mode), the kernel rejects the call with this error and changes nothing.","triggerScenarios":"Calling the setAppearance API with a theme parameter and modes containing 0 where the theme is not installed or is registered only as a dark theme.","commonSituations":"Typo in theme name; theme not installed on this machine; script copies a light/dark theme name across modes; theme marketplace package failed to install so it never appears in LightThemes.","solutions":["Verify the theme name matches an installed theme (Settings - Appearance - Theme) and fix the spelling","Install the theme package before setting it, then retry","Only pass mode 0 in modes if the theme actually supports light mode; otherwise use the mode it supports","Read Conf.Appearance.LightThemes to list valid names and choose from it"],"exampleFix":"// before\nSetTheme(\"midnight\", []int{0}, \"light\") // midnight is dark-only\n// after\nSetTheme(\"daylight\", []int{0}, \"light\")","handlingStrategy":"validation","validationCode":"const conf = await fetchPost(\"/api/setting/getAppearance\", {});\nif (modes.includes(0) && !conf.lightThemes.some(t => t.name === theme)) throw new Error(`theme ${theme} unavailable for light mode`);","typeGuard":null,"tryCatchPattern":"try {\n  await setTheme(theme, modes, mode);\n} catch (e) {\n  if (String(e).includes(\"not available for light mode\")) {\n    // choose from lightThemes or drop mode 0\n  }\n}","preventionTips":["Validate theme names against the installed lightThemes list before calling","Install theme packages before applying them","Do not reuse a dark-only theme name for light mode","Re-fetch the appearance config after marketplace installs, since lists change"],"tags":["appearance","theme","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"}