siyuan-note/siyuan · error
unsupported view state version %d
Error message
unsupported view state version %d
What it means
getViewStateStorage reads the persisted view-state JSON, peeks at its "version" header, and rejects any file whose version is newer than the version this kernel build understands (viewStateVersion). This forward-compatibility guard prevents misinterpreting a schema written by a newer SiYuan version.
Source
Thrown at kernel/model/view_state.go:320
}
dataPath := filepath.Join(util.DataDir, "storage", "view-state.json")
if !filelock.IsExist(dataPath) {
return
}
data, err := filelock.ReadFile(dataPath)
if err != nil {
logging.LogErrorf("read storage [view-state] failed: %s", err)
return nil, err
}
header := struct {
Version int `json:"version"`
}{}
if err = gulu.JSON.UnmarshalJSON(data, &header); err != nil {
return backupCorruptedViewState(dataPath, err)
}
if viewStateVersion < header.Version {
return nil, fmt.Errorf("unsupported view state version %d", header.Version)
}
if err = gulu.JSON.UnmarshalJSON(data, ret); err != nil {
return backupCorruptedViewState(dataPath, err)
}
if nil == ret.Views {
ret.Views = map[string]*ViewState{}
}
for key, state := range ret.Views {
if nil == state {
delete(ret.Views, key)
continue
}
if nil == state.Data {
state.Data = map[string]any{}
}
}
pruneViewStates(ret.Views)
for _, state := range ret.Views {View on GitHub (pinned to 8641553a1f)
Solutions
- Upgrade SiYuan kernel/app to a version whose viewStateVersion is >= the version reported in the error.
- Check the version field at the top of the view-state storage file to confirm which writer produced it.
- If downgrade is intentional, accept that view states from the newer version cannot be read (they are preserved on disk, not corrupted).
Defensive patterns
Strategy: try-catch
Try / catch
try {
await getViewState(id);
} catch (e) {
if (String(e).includes("unsupported view state version")) {
console.warn("View states written by a newer SiYuan version; upgrade to read them.");
} else { throw e; }
} Prevention
- Keep all SiYuan instances that share a workspace on the same or compatible version.
- Avoid running an older kernel against data written by a newer release.
- Note that this error means data is preserved, not lost — upgrading resolves it.
When it happens
Trigger: GetViewState, PatchViewState, or RemoveViewState loads the view-state storage file that was written by a newer kernel whose storage version header is greater than the current build's viewStateVersion.
Common situations: User downgraded SiYuan (or runs an older kernel binary) against data written by a newer version; or synced workspace data from a machine running a newer release.
Related errors
- Failed to save agent session
- agent context cannot be compacted enough: persist compaction
- decode existing session data failed: %w
- save session file failed: %w
- invalid bazaar index schema: %d
AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11).
Data as JSON: /api/errors/1b0e63d3964beb58.
Report an issue: GitHub.