{"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":"http","errorClass":null,"httpStatus":200,"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/afa823b6b4e4f183511e0bc0a3be93caa94c7c97/kernel/agent/runtime.go#L186-L222","documentation":"filelock.WriteFile failed to persist ~/.config/siyuan/workspace.json inside util.WriteWorkspacePaths. The JSON serialized fine but the disk write failed: no permission on ~/.config/siyuan, a read-only home filesystem, disk full, or the filelock layer unable to acquire/create its lock artifacts. The underlying error is appended.","triggerScenarios":"Switching or closing a workspace when the kernel user cannot write ~/.config/siyuan (ownership mismatch after container/user migration), HOME points somewhere read-only (systemd unit without proper env), disk quota exhausted, or an NFS/home mount denying the lock file creation used by filelock.","commonSituations":"Docker or systemd deployments where HOME is unset or owned by root; multi-user machines with restrictive home permissions; disk-full events; network home directories (NFS/Lustre) that interact badly with lock files.","solutions":["Read the appended error: 'permission denied' -> chown -R <kerneluser> ~/.config/siyuan (or chmod u+w); 'no space left on device' -> free space","Ensure the service/container sets HOME to a writable directory for the user the kernel runs as","Verify the directory exists: mkdir -p ~/.config/siyuan with the right ownership","On NFS-like filesystems, move the config dir to local storage or ensure lock files can be created in it"],"exampleFix":"# before: container runs as root but HOME volume owned by uid 1000\nHOME=/home/siyuan\n\n# after: align user and ownership\nuser: \"1000:1000\"\nvolumes: [\"/path/home:/home/siyuan\"]\n# and on the host: chown -R 1000:1000 /path/home/.config/siyuan","handlingStrategy":"retry","validationCode":"confDir := filepath.Join(home, \".config\", \"siyuan\")\nif err := os.MkdirAll(confDir, 0755); err != nil {\n    return fmt.Errorf(\"cannot prepare %s: fix permissions before workspace switch\", confDir)\n}","typeGuard":"null","tryCatchPattern":"err := util.WriteWorkspacePaths(paths)\nif err != nil && strings.Contains(err.Error(), \"write workspace conf\") {\n    time.Sleep(500 * time.Millisecond) // lock contention is transient\n    err = util.WriteWorkspacePaths(paths)\n}","preventionTips":["Run the kernel under a user that owns ~/.config/siyuan; verify with ls -ld at deploy time","Set HOME explicitly (and writable) in systemd/Docker units","Avoid concurrent kernel instances sharing one home dir; their file locks and writes will fight"],"tags":["workspace","config-file","filesystem","permissions","file-lock","disk-full"],"backgroundTag":"file-write-failed","analyzedSha":"afa823b6b4e4f183511e0bc0a3be93caa94c7c97","analyzedAt":"2026-08-18T17:04:10.865Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}