siyuan-note/siyuan · error
invalid database option name
Error message
invalid database option name
What it means
removeAttributeViewColumnOptionValues expects operation.Data to be a string naming the select-option to remove from a database column. If the type assertion fails (Data is not a string), it returns this sentinel error, because without a valid option name the removal cannot proceed.
Solutions
- Verify operation.Data is a plain string holding the option name before dispatching the operation
- Fix the producer of the Operation to set Data to the option name string
- If replaying old history, migrate/normalize old operation payloads to the current format
Example fix
// before
const op = { action: "removeAttributeViewColumnOptionValues", id: keyID, data: { name: "todo" } }
// after
const op = { action: "removeAttributeViewColumnOptionValues", id: keyID, data: "todo" } Defensive patterns
Strategy: validation
Validate before calling
if typeof op.data !== "string" || op.data.length === 0 { throw new Error("option name must be a non-empty string") } Try / catch
err := mutateAttributeViewOption(op)
if err != nil && err.Error() == "invalid database option name" {
// op.Data was not a string; normalize and retry
} Prevention
- Always serialize operation.Data as a plain string for option mutations
- Test undo/redo across version upgrades with old persisted operations
- Validate operation payloads before enqueueing them into the mutation queue
When it happens
Trigger: Calling the undo/redo mutation path (mutateAttributeViewOption with remove-option operation) when operation.Data was marshalled/stored as a non-string (e.g. an object, map, or nil from a malformed operation payload).
Common situations: Undo/redo replaying operations persisted by an older version that stored option data as an object; plugins pushing hand-crafted Operation payloads with wrong Data type; JSON round-trip losing the string.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- database back relation values
- database entry [ ] changed since deletion was undone
- database entry [ ] has newer field values
- database entry [ ] was removed after the field
- database field [ ] changed after the operation
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/7621b25fc8829c9c.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/attribute_view_option_undo.go:171
return nil
}
func removeAttributeViewColumnOption(operation *Operation) (err error) {
tx := &Transaction{trees: map[string]*parse.Tree{}}
defer func() { tx.finishAttributeViewMutation(err != nil) }()
return tx.mutateAttributeViewOption(operation, true)
}
func updateAttributeViewColumnOption(operation *Operation) (err error) {
tx := &Transaction{trees: map[string]*parse.Tree{}}
defer func() { tx.finishAttributeViewMutation(err != nil) }()
return tx.mutateAttributeViewOption(operation, false)
}
func removeAttributeViewColumnOptionValues(attrView *av.AttributeView, operation *Operation) (err error) {
optName, ok := operation.Data.(string)
if !ok {
return errors.New("invalid database option name")
}
key, err := attrView.GetKey(operation.ID)
if err != nil {
return
}
for i, opt := range key.Options {
if optName == opt.Name {
key.Options = append(key.Options[:i], key.Options[i+1:]...)
break
}
}
attrView.RemoveNewItemTemplateSelectOption(operation.ID, optName)
for _, keyValues := range attrView.KeyValues {
if keyValues.Key.ID != operation.ID {
continueView on GitHub (pinned to 9f775e8a12)