{"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/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/ai_editor.go#L148-L184","documentation":"loadAIEditorActions enforces that the file's version field equals aiEditorActionsVersion (1). If the stored JSON declares any other version (older or newer), the loader refuses to proceed rather than guess at the schema. This is a forward/backward compatibility guard for the on-disk format.","triggerScenarios":"GetAIEditorActions, SaveAIEditorAction, or RemoveAIEditorAction loads an actions.json whose version field was edited to another integer, or the file was written by a different (future or past) build with an incompatible version constant.","commonSituations":"The user hand-edited the file and changed the version number; the file was produced by a newer development build of the kernel and then opened by an older release; a sync brought a file from a machine running a different version.","solutions":["Check the reported version against the supported value (1 in this codebase); do not hand-edit it to 1 blindly — confirm the schema also matches v1","If the file was written by a newer build, upgrade SiYuan to that build instead of downgrading the data","If the version was tampered with and the actions array matches the v1 schema, restore version to 1 in the file (keep a backup first)","Restore the file from sync history or backup if it originated from an incompatible source"],"exampleFix":"// before: version edited away from the supported value\n{\"version\":99,\"actions\":[...]}\n// after\n{\"version\":1,\"actions\":[...]}","handlingStrategy":"validation","validationCode":"raw, _ := os.ReadFile(\"data/storage/ai/editor/actions.json\")\nvar probe struct{ Version int `json:\"version\"` }\nif err := json.Unmarshal(raw, &probe); err == nil && probe.Version != 1 {\n    return fmt.Errorf(\"unsupported actions.json version %d; upgrade SiYuan\", probe.Version)\n}","typeGuard":null,"tryCatchPattern":"actions, err := GetAIEditorActions()\nif err != nil && strings.Contains(err.Error(), \"unsupported AI editor actions version\") {\n    return fmt.Errorf(\"data written by an incompatible SiYuan version; upgrade the kernel: %w\", err)\n}","preventionTips":["Do not modify the version field in actions.json","Keep all synced machines on the same SiYuan kernel version","When downgrading the app, first migrate or remove newer-format data files"],"tags":["versioning","compatibility","schema","ai-editor"],"backgroundTag":"unsupported-enum-value","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}