siyuan-note/siyuan · warning
invalid AI editor action ID
Error message
invalid AI editor action ID
What it means
SaveAIEditorAction validates a caller-supplied ID against ast.IsNodeIDPattern (SiYuan's node-ID format, e.g. timestamp-based digit groups). A non-empty ID that does not match this pattern is rejected with "invalid AI editor action ID" so that auto-generated IDs and stored references stay consistent.
Solutions
- Omit the `id` field entirely when creating a new action — the kernel assigns a valid node ID
- When updating, use the exact ID returned by the list API (GetAIEditorActions), not a hand-made value
- Regenerate/convert your identifier into SiYuan node-ID format if you must control IDs
Example fix
// before
saveAIEditorAction(&AIEditorAction{ID: "550e8400-e29b-41d4-a716-446655440000", Name: "Summarize"})
// after
saveAIEditorAction(&AIEditorAction{Name: "Summarize", Action: "Summarize this text"}) // ID left empty, kernel assigns one Defensive patterns
Strategy: validation
Validate before calling
const isNodeID = (id) => typeof id === "string" && /^\d{14}-[0-9a-z]{7}$/.test(id); // siyuan node-ID shape
if (action.id && !isNodeID(action.id)) throw new Error("id must be a SiYuan node ID or omitted"); Type guard
const hasValidID = (a) => !a.id || /^\d{14}-[0-9a-z]{7}$/.test(a.id); Try / catch
try {
await saveAIEditorAction(action);
} catch (e) {
if (e.message.includes("invalid AI editor action ID")) { delete action.id; await saveAIEditorAction(action); } // create new
} Prevention
- Omit ID when creating actions
- Only reuse IDs returned by the kernel
- Never generate action IDs yourself
When it happens
Trigger: Calling SaveAIEditorAction with action.ID set to a UUID, slug, numeric string, or any value not matching the SiYuan node-ID pattern; copying an ID from another system; typos when hardcoding an ID.
Common situations: Plugins generating their own IDs (uuid v4) instead of omitting ID to let the kernel generate one; hand-crafted API payloads with placeholder IDs like "test" or "1".
Understand the failure class
Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.
Related errors
- Field [id] must not be empty
- invalid notebook ID
- AI editor action must not be empty
- block [ ] type is locked: expected , got
- block swap requires two non-document blocks
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/4ba4e18055013639.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/ai_editor.go:75
aiEditorActionsLock.Lock()
defer aiEditorActionsLock.Unlock()
data, err := loadAIEditorActions()
if err != nil {
return nil, err
}
if err = migrateLegacyAIEditorActions(data, !util.ReadOnly); err != nil {
return nil, err
}
return data.Actions, nil
}
func SaveAIEditorAction(action *AIEditorAction) (ret *AIEditorAction, err error) {
if action == nil || (action.Name == "" && action.Action == "") {
return nil, errors.New("AI editor action must not be empty")
}
if action.ID != "" && !ast.IsNodeIDPattern(action.ID) {
return nil, errors.New("invalid AI editor action ID")
}
waitForSyncingStorages()
aiEditorActionsLock.Lock()
defer aiEditorActionsLock.Unlock()
data, err := loadAIEditorActions()
if err != nil {
return nil, err
}
if err = migrateLegacyAIEditorActions(data, true); err != nil {
return nil, err
}
ret = &AIEditorAction{
ID: action.ID,
Name: action.Name,
Action: action.Action,View on GitHub (pinned to 9f775e8a12)