{"record":{"id":"5b4352f6d55a2b8e","repo":"siyuan-note/siyuan","slug":"remove-legacy-ai-editor-actions-failed-w","errorCode":null,"errorMessage":"remove legacy AI editor actions failed: %w","messagePattern":"remove legacy AI editor actions failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/ai_editor.go","lineNumber":262,"sourceCode":"\t\t}\n\t\tdata.Actions = append(data.Actions, &AIEditorAction{\n\t\t\tID:     ast.NewNodeID(),\n\t\t\tName:   legacyAction.Name,\n\t\t\tAction: legacyAction.Memo,\n\t\t})\n\t\texisting[key] = struct{}{}\n\t\tchanged = true\n\t}\n\tif !persist {\n\t\treturn nil\n\t}\n\tif changed {\n\t\tif err = saveAIEditorActions(data); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err = RemoveLocalStorageVals([]string{legacyAIEditorActionsStorageKey}); err != nil {\n\t\treturn fmt.Errorf(\"remove legacy AI editor actions failed: %w\", err)\n\t}\n\treturn nil\n}\n","sourceCodeStart":244,"sourceCodeEnd":266,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/ai_editor.go#L244-L266","documentation":"After successfully migrating legacy AI editor actions, the kernel deletes the legacy local-storage key via RemoveLocalStorageVals. This error wraps a failure of that removal, meaning migration data would linger and potentially re-run; the caller's get/save/remove operation returns the error even though the migration itself already succeeded and was saved.","triggerScenarios":"Calling GetAIEditorActions, SaveAIEditorAction, or RemoveAIEditorAction during legacy migration when the underlying local-storage delete fails (storage backend unavailable, file lock or write error on the workspace storage).","commonSituations":"Workspace directory on a read-only or full disk; antivirus or sync tool locking the storage files; concurrent SiYuan instances writing the same workspace storage.","solutions":["Check that the workspace data directory and local-storage files are writable and not locked, then retry","Close other SiYuan instances or file-sync tools holding the workspace and retry the operation","If removal keeps failing, manually delete the legacy key from workspace storage after backing it up","Free disk space if the volume is full"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// ensure workspace storage is writable before API calls\nawait fs.access(workspaceDir, fs.constants.W_OK);","typeGuard":null,"tryCatchPattern":"try {\n  await getAIEditorActions();\n} catch (e) {\n  if (String(e).includes(\"remove legacy AI editor actions failed\")) {\n    // check disk space/locks on workspace storage, then retry; migration data already saved\n  }\n}","preventionTips":["Keep the workspace directory writable (avoid read-only mounts and full disks)","Run only one SiYuan instance per workspace","Exclude the workspace from antivirus/file-sync locking during upgrades","Retry the operation once; the migration result is already persisted"],"tags":["storage","migration","ai-editor","file-write"],"backgroundTag":"file-write-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"}