siyuan-note/siyuan · warning

invalid boot appearance selection

Error message

invalid boot appearance selection

What it means

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.

Solutions

  1. Delete or fix the selection config file so a fresh default is written on next load
  2. Re-save a valid selection via SetBootAppearance after upgrading
  3. Don't hand-edit the config; change selections through the API

Example fix

// before
// hand-edited file: {"schemaVersion":1,"provider":"p","appearance":""}
// after
// reset via API: SetBootAppearance("", "") then SetBootAppearance("p", "a")
// or delete the invalid selection file to fall back to defaults
Defensive patterns

Strategy: fallback

Validate before calling

// none needed pre-call; error occurs when loading persisted config
var sel model.BootAppearanceSelection
if err := gulu.JSON.UnmarshalJSON(data, &sel); err != nil || sel.SchemaVersion != expected { sel = model.DefaultBootAppearanceSelection() }

Try / catch

sel, err := loadBootAppearanceSelection()
if err != nil { sel = defaultBootAppearanceSelection() /* already default + log warn */ }

Prevention

When it happens

Trigger: 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.

Common situations: Upgrading/downgrading SiYuan across versions that changed the schema; manual editing of workspace config files; partially written config after a crash.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/6d38e26b873b8e03. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/boot_appearance.go:292

	appearanceDir := filepath.Join(pluginDir, bootAppearanceDirName, appearanceID)
	filePath, contentType, err = validateBootAppearanceResource(pluginDir, appearanceDir, relativePath, "")
	return
}

func loadBootAppearanceSelection() (ret BootAppearanceSelection, err error) {
	ret = defaultBootAppearanceSelection()
	bootAppearanceConfLock.RLock()
	defer bootAppearanceConfLock.RUnlock()
	data, err := filelock.ReadFile(filepath.Join(util.ConfDir, bootAppearanceConfigName))
	if err != nil {
		return ret, err
	}
	if err = gulu.JSON.UnmarshalJSON(data, &ret); err != nil {
		return ret, err
	}
	if ret.SchemaVersion != bootAppearanceSchemaVersion || (ret.Provider == "") != (ret.Appearance == "") {
		return defaultBootAppearanceSelection(), errors.New("invalid boot appearance selection")
	}
	if ret.Provider != "" && (!bazaar.IsValidPackageName(ret.Provider) || !isValidBootAppearanceID(ret.Appearance)) {
		return defaultBootAppearanceSelection(), errors.New("invalid boot appearance selection")
	}
	return
}

func defaultBootAppearanceSelection() BootAppearanceSelection {
	return BootAppearanceSelection{SchemaVersion: bootAppearanceSchemaVersion}
}

func loadSelectedBootAppearance() (selection BootAppearanceSelection, appearance *BootAppearance, err error) {
	selection, err = loadBootAppearanceSelection()
	if err != nil || selection.Provider == "" {
		return
	}
	appearance, err = getBootAppearanceByID(selection.Provider, selection.Appearance)
	if err != nil {

View on GitHub (pinned to 9f775e8a12)