siyuan-note/siyuan · warning
read-only mode
Error message
read-only mode
What it means
SetBootAppearance persists the boot (splash) appearance selection, but in read-only mode the workspace configuration must not change. When util.ReadOnly is true the call is rejected with 'read-only mode' and the current default selection is returned unchanged.
Solutions
- Restart the kernel without read-only mode before changing boot appearance
- Make the change in a writable instance/workspace instead
- Have the UI hide/disable appearance settings when read-only is active
Example fix
// before
_, err := model.SetBootAppearance(provider, id) // may fail in read-only
// after
if util.ReadOnly { return errors.New("cannot change boot appearance in read-only mode") }
_, err := model.SetBootAppearance(provider, id) Defensive patterns
Strategy: try-catch
Validate before calling
if util.ReadOnly { return errors.New("workspace is read-only") } Try / catch
sel, err := model.SetBootAppearance(p, id)
if err != nil && strings.Contains(err.Error(), "read-only") {
// disable UI and inform user the workspace is read-only
} Prevention
- Check util.ReadOnly before offering write-config UI
- Don't attempt config writes on demo/read-only deployments
- Surface read-only state in the settings UI
When it happens
Trigger: Calling SetBootAppearance (or its HTTP API) while the kernel runs in read-only mode — e.g. read-only startup flag, workspace on read-only media, or read-only enforced by the environment.
Common situations: Accessing a SiYuan instance started with read-only enabled (demo/preview deployments, shared workspaces); automated tests or scripts trying to change settings on such an instance.
Understand the failure class
Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.
Related errors
- boot appearance asset forbidden
- boot appearance not found
- invalid appearance ID
- invalid boot appearance selection
- provider and appearance must both be empty or non-empty
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/f55072265741546b.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/boot_appearance.go:214
// GetBootAppearance 返回当前可用的启动页外观,任何异常和安全模式下均回退默认。
func GetBootAppearance() *BootAppearance {
if util.SafeMode {
return &BootAppearance{Enabled: false}
}
selection, appearance, err := loadSelectedBootAppearance()
if err != nil {
return &BootAppearance{Enabled: false}
}
if selection.Provider == "" || selection.Appearance == "" {
return &BootAppearance{Enabled: false}
}
return appearance
}
// SetBootAppearance 校验并原子持久化启动页外观选择,两项均为空表示恢复默认。
func SetBootAppearance(provider, appearanceID string) (ret BootAppearanceSelection, err error) {
if util.ReadOnly {
return defaultBootAppearanceSelection(), errors.New("read-only mode")
}
provider = strings.TrimSpace(provider)
appearanceID = strings.TrimSpace(appearanceID)
ret = defaultBootAppearanceSelection()
if (provider == "") != (appearanceID == "") {
err = errors.New("provider and appearance must both be empty or non-empty")
return
}
if provider != "" {
if !bazaar.IsValidPackageName(provider) || !isValidBootAppearanceID(appearanceID) {
err = ErrBootAppearanceNotFound
return
}
if _, resolveErr := getBootAppearanceByID(provider, appearanceID); resolveErr != nil {
err = ErrBootAppearanceNotFound
return
}
ret.Provider, ret.Appearance = provider, appearanceIDView on GitHub (pinned to 9f775e8a12)