{"record":{"id":"900d4ca14d996c6b","repo":"siyuan-note/siyuan","slug":"unsupported-ai-editor-actions-version-d","errorCode":null,"errorMessage":"unsupported AI editor actions version [%d]","messagePattern":"unsupported AI editor actions version \\[(.+?)\\]","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/ai_editor.go","lineNumber":166,"sourceCode":"func loadAIEditorActions() (ret *aiEditorActionsData, err error) {\n\tret = &aiEditorActionsData{\n\t\tVersion: aiEditorActionsVersion,\n\t\tActions: []*AIEditorAction{},\n\t}\n\tdataPath := aiEditorActionsPath()\n\tif !filelock.IsExist(dataPath) {\n\t\treturn ret, nil\n\t}\n\n\tdata, err := filelock.ReadFile(dataPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"read AI editor actions failed: %w\", err)\n\t}\n\tif err = gulu.JSON.UnmarshalJSON(data, ret); err != nil {\n\t\treturn nil, fmt.Errorf(\"unmarshal AI editor actions failed: %w\", err)\n\t}\n\tif ret.Version != aiEditorActionsVersion {\n\t\treturn nil, fmt.Errorf(\"unsupported AI editor actions version [%d]\", ret.Version)\n\t}\n\tif ret.Actions == nil {\n\t\tret.Actions = []*AIEditorAction{}\n\t}\n\n\tids := make(map[string]struct{}, len(ret.Actions))\n\tfor _, action := range ret.Actions {\n\t\tif action == nil || !ast.IsNodeIDPattern(action.ID) || (action.Name == \"\" && action.Action == \"\") {\n\t\t\treturn nil, errors.New(\"invalid AI editor action data\")\n\t\t}\n\t\tif _, ok := ids[action.ID]; ok {\n\t\t\treturn nil, fmt.Errorf(\"duplicate AI editor action ID [%s]\", action.ID)\n\t\t}\n\t\tids[action.ID] = struct{}{}\n\t}\n\treturn ret, nil\n}\n","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/ai_editor.go#L148-L184","documentation":"loadAIEditorActions enforces that the stored aiEditorActionsData.Version equals the current aiEditorActionsVersion constant. When the on-disk file was written by a different (older or newer) format version, this error is returned to GetAIEditorActions/SaveAIEditorAction/RemoveAIEditorAction. There is no downgrade/upgrade migration for arbitrary versions.","triggerScenarios":"The actions file in the workspace contains a version field different from aiEditorActionsVersion — typically a file created by a newer SiYuan build then opened by an older kernel, or a hand-edited file with a wrong version value.","commonSituations":"Downgrading SiYuan after using a newer format; copying a data directory between machines with different SiYuan versions; manually editing the JSON and mistyping the version number; restoring an old backup whose format predates the current constant.","solutions":["Check the reported version in the message against the kernel's aiEditorActionsVersion constant in kernel/model/ai_editor.go.","Upgrade SiYuan to the version that wrote the file (if file version is newer) rather than editing the file.","For an older version, migrate manually: back up the file, adjust the version field to the current constant, and ensure actions entries satisfy validation.","If the data is disposable, delete the actions file so it is recreated empty; otherwise hand-port actions via the AI editor UI into a fresh file."],"exampleFix":"// before: stale version in data file\n{\"version\":0,\"actions\":[...]}\n// after: match aiEditorActionsVersion\n{\"version\":1,\"actions\":[...]}","handlingStrategy":"fallback","validationCode":"// pre-check stored version\ncodec: const data = JSON.parse(fs.readFileSync(actionsPath,'utf8'));\nif (data.version !== CURRENT_AI_EDITOR_ACTIONS_VERSION) console.warn('version mismatch:', data.version);","typeGuard":null,"tryCatchPattern":"try {\n  const actions = await fetchSyncPost('/api/ai/editor/getAIEditorActions', {});\n} catch (e) {\n  if (/unsupported AI editor actions version/.test(e.message)) {\n    // upgrade the kernel to the version that wrote the file, or migrate/restore backup\n  }\n}","preventionTips":["Avoid downgrading SiYuan after newer format writes","Pin the same SiYuan version across machines sharing a workspace","Never hand-edit the version field","Snapshot the data dir before version-changing upgrades"],"tags":["versioning","compatibility","persistence","schema"],"backgroundTag":"unsupported-config-value","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"}