siyuan-note/siyuan · error
option settings require a select or mSelect field
Error message
option settings require a select or mSelect field
What it means
The option-management settings 'options' (replace), 'optionUpdate', and 'optionRemove' operate on select-type option lists, so they are valid only on fields of type 'select' or 'mSelect'. UpdateAttributeViewKeyConfig rejects them for any other field type with 'option settings require a select or mSelect field'.
Solutions
- Change the field type to 'select' or 'mSelect' via the 'type' setting before managing options.
- Check key.Type before the call and skip option settings for non-select fields.
- Verify the keyID points at the intended select field (IDs can be mixed up when iterating fields).
Example fix
// before
UpdateAttributeViewKeyConfig(avID, textFieldID, {"optionRemove": "old"})
// after
UpdateAttributeViewKeyConfig(avID, selectFieldID, {"optionRemove": "old"}) Defensive patterns
Strategy: validation
Validate before calling
// JS: option settings only for select/mSelect fields
if (!["select", "mSelect"].includes(key.type)) throw new Error("option settings require a select or mSelect field"); Type guard
function isSelectLike(key) { return key && (key.type === "select" || key.type === "mSelect"); } Try / catch
try { await updateKeyConfig(avID, keyID, { options: newOptions }); } catch (e) { if (String(e).includes("select or mSelect")) { throw new Error("Field " + keyID + " is not a select field; change type first"); } throw e; } Prevention
- Verify keyID resolves to a select/mSelect field before option operations
- Change field type to select first if option management is required
- When iterating fields in bulk, filter by type before applying option settings
When it happens
Trigger: Calling UpdateAttributeViewKeyConfig with any of {"options": [...]}, {"optionUpdate": ...}, or {"optionRemove": ...} where key.Type is neither KeyTypeSelect nor KeyTypeMSelect.
Common situations: A sync/import script rewrites option lists across all select-like fields but includes single-select-in-spirit fields that are actually of another type; the field's type was changed away from select while the client kept applying option updates.
Understand the failure class
Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.
Related errors
- duplicate option name
- each option requires a nonempty name
- includeTime requires a created or updated field
- invalid option color
- new option name must not be empty
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/94480df52535ecbf.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/attribute_view_key_config.go:108
if "includeTime" == setting {
switch key.Type {
case av.KeyTypeCreated:
return setAttrViewCreatedIncludeTime(op)
case av.KeyTypeUpdated:
return setAttrViewUpdatedIncludeTime(op)
}
return errors.New("includeTime requires a created or updated field")
}
if av.KeyTypeDate != key.Type {
return fmt.Errorf("%s requires a date field", setting)
}
if "autoFillNow" == setting {
return setAttributeViewColDateFillCreated(op)
}
return setAttrViewColDateFillSpecificTime(op)
case "options", "optionUpdate", "optionRemove":
if av.KeyTypeSelect != key.Type && av.KeyTypeMSelect != key.Type {
return errors.New("option settings require a select or mSelect field")
}
return updateAttributeViewKeyOptions(attrView, key, op, setting, value)
case "relation":
return updateAttributeViewKeyRelation(key, op, value)
case "rollup":
return updateAttributeViewKeyRollup(attrView, key, op, value)
case "relationFilters", "rollupFilters":
filters, ok := value.([]any)
if !ok {
return errors.New("filters must be an array")
}
if err = validateAttributeViewKeyFilters(attrView, key, setting, filters); nil != err {
return err
}
return setAttrViewColFilters(avID, "", keyID, filters, "relationFilters" == setting)
default:
return fmt.Errorf("unknown field setting: %s", setting)
}View on GitHub (pinned to 9f775e8a12)