{"record":{"id":"ad34bd7739dbb499","repo":"siyuan-note/siyuan","slug":"unsupported-agent-runtime-schema-version-d","errorCode":null,"errorMessage":"unsupported agent runtime schema version: %d","messagePattern":"unsupported agent runtime schema version: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/agent/runtime.go","lineNumber":204,"sourceCode":"\nfunc runtimePath(sessionID string) string {\n\treturn filepath.Join(sessionsDir(), sessionID, \"runtime.json\")\n}\n\nfunc loadRuntimeLocked(sessionID string) (*agentRuntime, error) {\n\tdata, err := os.ReadFile(runtimePath(sessionID))\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn &agentRuntime{SchemaVersion: 1, SessionID: sessionID}, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\tvar runtime agentRuntime\n\tif err := gulu.JSON.UnmarshalJSON(data, &runtime); err != nil {\n\t\treturn nil, err\n\t}\n\tif runtime.SchemaVersion > 1 {\n\t\treturn nil, fmt.Errorf(\"unsupported agent runtime schema version: %d\", runtime.SchemaVersion)\n\t}\n\tif runtime.SessionID != \"\" && runtime.SessionID != sessionID {\n\t\treturn nil, fmt.Errorf(\"agent runtime session id mismatch\")\n\t}\n\tif runtime.Revision < 0 {\n\t\treturn nil, fmt.Errorf(\"invalid agent runtime revision\")\n\t}\n\tif runtime.ActiveTurn != nil {\n\t\tif runtime.ActiveTurn.TurnID == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"invalid agent runtime turn id\")\n\t\t}\n\t\tswitch runtime.ActiveTurn.State {\n\t\tcase \"running\", \"finished\", \"interrupted\":\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"invalid agent runtime turn state\")\n\t\t}\n\t}\n\tif runtime.SchemaVersion == 0 {","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/agent/runtime.go#L186-L222","documentation":"loadRuntimeLocked unmarshals the persisted session runtime JSON and rejects any runtime whose SchemaVersion exceeds the highest version this kernel build understands (currently 1). This guards against forward-compatibility breakage: a newer SiYuan wrote the runtime file, and an older build is trying to read it.","triggerScenarios":"Loading a session.json runtime file written by a newer kernel version where runtime.SchemaVersion > 1, via any of loadRuntimeLocked's callers (SetSessionPermissionMode, beginRuntimeTurn, saveRuntimeTurn, saveRuntimeCompaction, loadRuntimeState, resolveSessionPermissionModeLocked).","commonSituations":"Downgrading the SiYuan kernel after a newer version created agent sessions; syncing a workspace between machines running different kernel versions; restoring a backup made by a newer build.","solutions":["Upgrade the kernel to a build that supports the runtime's schema version (SchemaVersion <= 1 for this build)","If downgrade is intentional, delete or regenerate the affected agent session runtime files, accepting loss of that session's runtime state","Confirm the workspace was not synced from a newer installation and pin all installations to the same kernel version"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const runtime = JSON.parse(readRuntimeFile());\nif (runtime.schemaVersion > 1) throw new Error(\"runtime written by a newer kernel; upgrade required\");","typeGuard":null,"tryCatchPattern":"try { beginRuntimeTurn(sessionID, turn) } catch (err) {\n  if (strings.Contains(err.Error(), \"unsupported agent runtime schema version\")) {\n    // surface an \"upgrade required\" message instead of retrying\n  }\n}","preventionTips":["Keep all SiYuan installations that share a workspace on the same kernel version","After upgrading, avoid downgrading without clearing/regenerating agent session state","Back up the workspace data directory before any version change"],"tags":["agent","schema-version","forward-compatibility"],"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"}