siyuan-note/siyuan · error
new item template field
Error message
new item template field [%s] type [%s] is not editable
What it means
Template field values are only allowed for key types considered editable (checked by isNewItemTemplateEditableKeyType, e.g. text, number, date, select, URL, etc.). If a FieldValues entry resolves to a key whose type is not editable — such as a computed/rollup/created/updated or template field — the configuration is rejected.
Solutions
- Remove the non-editable key from the template's FieldValues map
- Check the key's Type via av.GetKey(keyID) and only include keys accepted by isNewItemTemplateEditableKeyType
- If the field type changed, recreate the template config against a suitable editable field
Example fix
// before
if _, err := av.GetKey(rollupKeyID); err == nil {
template.FieldValues[rollupKeyID] = fieldValue // rollup is not editable
}
// after
if key, err := av.GetKey(textKeyID); err == nil && isNewItemTemplateEditableKeyType(key.Type) {
template.FieldValues[textKeyID] = fieldValue
}
err := av.SetNewItemTemplates(config) Defensive patterns
Strategy: validation
Validate before calling
if key, err := av.GetKey(keyID); err != nil || !isNewItemTemplateEditableKeyType(key.Type) {
delete(template.FieldValues, keyID)
} Prevention
- Check isNewItemTemplateEditableKeyType (or the key's Type) before adding any FieldValues entry
- Re-validate templates after a field's type is changed in the database
When it happens
Trigger: Calling SetNewItemTemplates with FieldValues targeting a key whose Type fails isNewItemTemplateEditableKeyType, e.g. a template/rollup/created-time field that cannot have pre-filled values.
Common situations: Pointing a new-item template at an auto-generated or read-only field; a key's type changed after the template was configured (field converted to a non-editable type); building configs programmatically without checking key type.
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
- at least one visible view is required
- attribute view custom color index
- attribute view custom color must not be null
- attribute view custom colors count exceeds the
- attribute view custom colors must not be empty
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/fb7170d8721c3e5b.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/av/new_item_template.go:314
return ret[i].KeyID < ret[j].KeyID
})
return
}
func (av *AttributeView) normalizeNewItemTemplateFieldValues(itemTemplate *NewItemTemplate) error {
if 0 == len(itemTemplate.FieldValues) {
itemTemplate.FieldValues = nil
return nil
}
fieldValues := map[string]*NewItemFieldValue{}
for keyID, fieldValue := range itemTemplate.FieldValues {
key, err := av.GetKey(keyID)
if nil != err || nil == key {
return fmt.Errorf("new item template field [%s] not found", keyID)
}
if !isNewItemTemplateEditableKeyType(key.Type) {
return fmt.Errorf("new item template field [%s] type [%s] is not editable", keyID, key.Type)
}
if nil == fieldValue {
continue
}
if "" == fieldValue.Mode {
fieldValue.Mode = NewItemFieldValueStatic
}
switch fieldValue.Mode {
case NewItemFieldValueCurrentTime:
if KeyTypeDate != key.Type {
return fmt.Errorf("new item template field [%s] current time mode requires date type", keyID)
}
fieldValue.Value = nil
case NewItemFieldValueStatic:
if nil == fieldValue.Value {
continue
}
fieldValue.Value, err = normalizeNewItemTemplateValue(fieldValue.Value, key)View on GitHub (pinned to 9f775e8a12)