siyuan-note/siyuan · error
remove legacy AI editor actions failed
Error message
remove legacy AI editor actions failed: %w
What it means
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.
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
Defensive patterns
Strategy: try-catch
Validate before calling
// ensure workspace storage is writable before API calls await fs.access(workspaceDir, fs.constants.W_OK);
Try / catch
try {
await getAIEditorActions();
} catch (e) {
if (String(e).includes("remove legacy AI editor actions failed")) {
// check disk space/locks on workspace storage, then retry; migration data already saved
}
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Understand the failure class
Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.
Related errors
- agent context cannot be compacted enough: persist compaction
- attribute view definition is not a regular file
- attribute view spec is too new
- cannot read pinned document
- cannot remove storage root
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/5b4352f6d55a2b8e.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/ai_editor.go:262
}
data.Actions = append(data.Actions, &AIEditorAction{
ID: ast.NewNodeID(),
Name: legacyAction.Name,
Action: legacyAction.Memo,
})
existing[key] = struct{}{}
changed = true
}
if !persist {
return nil
}
if changed {
if err = saveAIEditorActions(data); err != nil {
return err
}
}
if err = RemoveLocalStorageVals([]string{legacyAIEditorActionsStorageKey}); err != nil {
return fmt.Errorf("remove legacy AI editor actions failed: %w", err)
}
return nil
}
View on GitHub (pinned to 9f775e8a12)