{"record":{"id":"6d38e26b873b8e03","repo":"siyuan-note/siyuan","slug":"invalid-boot-appearance-selection","errorCode":null,"errorMessage":"invalid boot appearance selection","messagePattern":"invalid boot appearance selection","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"kernel/model/boot_appearance.go","lineNumber":292,"sourceCode":"\n\tappearanceDir := filepath.Join(pluginDir, bootAppearanceDirName, appearanceID)\n\tfilePath, contentType, err = validateBootAppearanceResource(pluginDir, appearanceDir, relativePath, \"\")\n\treturn\n}\n\nfunc loadBootAppearanceSelection() (ret BootAppearanceSelection, err error) {\n\tret = defaultBootAppearanceSelection()\n\tbootAppearanceConfLock.RLock()\n\tdefer bootAppearanceConfLock.RUnlock()\n\tdata, err := filelock.ReadFile(filepath.Join(util.ConfDir, bootAppearanceConfigName))\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\tif err = gulu.JSON.UnmarshalJSON(data, &ret); err != nil {\n\t\treturn ret, err\n\t}\n\tif ret.SchemaVersion != bootAppearanceSchemaVersion || (ret.Provider == \"\") != (ret.Appearance == \"\") {\n\t\treturn defaultBootAppearanceSelection(), errors.New(\"invalid boot appearance selection\")\n\t}\n\tif ret.Provider != \"\" && (!bazaar.IsValidPackageName(ret.Provider) || !isValidBootAppearanceID(ret.Appearance)) {\n\t\treturn defaultBootAppearanceSelection(), errors.New(\"invalid boot appearance selection\")\n\t}\n\treturn\n}\n\nfunc defaultBootAppearanceSelection() BootAppearanceSelection {\n\treturn BootAppearanceSelection{SchemaVersion: bootAppearanceSchemaVersion}\n}\n\nfunc loadSelectedBootAppearance() (selection BootAppearanceSelection, appearance *BootAppearance, err error) {\n\tselection, err = loadBootAppearanceSelection()\n\tif err != nil || selection.Provider == \"\" {\n\t\treturn\n\t}\n\tappearance, err = getBootAppearanceByID(selection.Provider, selection.Appearance)\n\tif err != nil {","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/boot_appearance.go#L274-L310","documentation":"loadBootAppearanceSelection parses the persisted boot-appearance selection JSON and validates its shape. If the schema version doesn't match the current one, or provider/appearance are inconsistently set (one empty, one not), the persisted file is considered invalid and the function returns this error together with the default selection.","triggerScenarios":"Reading a selection file written by an older/newer kernel with a different bootAppearanceSchemaVersion; a hand-edited or corrupted JSON file where exactly one of Provider/Appearance is set.","commonSituations":"Upgrading/downgrading SiYuan across versions that changed the schema; manual editing of workspace config files; partially written config after a crash.","solutions":["Delete or fix the selection config file so a fresh default is written on next load","Re-save a valid selection via SetBootAppearance after upgrading","Don't hand-edit the config; change selections through the API"],"exampleFix":"// before\n// hand-edited file: {\"schemaVersion\":1,\"provider\":\"p\",\"appearance\":\"\"}\n// after\n// reset via API: SetBootAppearance(\"\", \"\") then SetBootAppearance(\"p\", \"a\")\n// or delete the invalid selection file to fall back to defaults","handlingStrategy":"fallback","validationCode":"// none needed pre-call; error occurs when loading persisted config\nvar sel model.BootAppearanceSelection\nif err := gulu.JSON.UnmarshalJSON(data, &sel); err != nil || sel.SchemaVersion != expected { sel = model.DefaultBootAppearanceSelection() }","typeGuard":null,"tryCatchPattern":"sel, err := loadBootAppearanceSelection()\nif err != nil { sel = defaultBootAppearanceSelection() /* already default + log warn */ }","preventionTips":["Don't hand-edit boot appearance config files","Re-save selections after SiYuan version upgrades","Keep Provider and Appearance set or empty together","Back up config before manual workspace surgery"],"tags":["go","kernel","config","schema","boot-appearance"],"backgroundTag":"schema-validation-failed","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"}