siyuan-note/siyuan · error

new item template field [%s] type [%s] is not editable

Error message

new item template field [%s] type [%s] is not editable

What it means

The referenced key exists but its type is not in the editable whitelist isNewItemTemplateEditableKeyType: only Text, Number, Date, Select, MSelect, URL, Email, Phone, MAsset, Checkbox, and Relation can be templated. System/computed types (Block, Template, Created, Updated, Rollup, Layout) are rejected because they auto-populate or derive their value.

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 251596fc0d)

Solutions

  1. Only bind field types returned true by isNewItemTemplateEditableKeyType.
  2. For Created/Updated/etc., omit them from FieldValues — they are filled automatically on row creation.
  3. After a column-type change, re-save the template so the validator can re-check the new type.

Example fix

// before — binding a Rollup column
FieldValues["rollup-key"] = &av.NewItemFieldValue{...}
// after — remove it; bind a Text column instead
FieldValues["text-key"] = &av.NewItemFieldValue{...}
Defensive patterns

Strategy: type-guard

Type guard

// Mirror isNewItemTemplateEditableKeyType (new_item_template.go:459) on the client.
func isEditableKeyType(t av.KeyType) bool {
    switch t {
    case av.KeyTypeText, av.KeyTypeNumber, av.KeyTypeDate, av.KeyTypeSelect,
        av.KeyTypeMSelect, av.KeyTypeURL, av.KeyTypeEmail, av.KeyTypePhone,
        av.KeyTypeMAsset, av.KeyTypeCheckbox, av.KeyTypeRelation:
        return true
    }
    return false
}

Prevention

When it happens

Trigger: User binds a Rollup or Created/Updated column into a template; UI bug exposes a non-editable column in the template field picker; version skew introducing a new computed type.

Common situations: Client allows picking any column; schema migration that turned an editable column into a Rollup; stale template config after a column-type change.

Related errors


AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12). Data as JSON: /api/errors/fb7170d8721c3e5b. Report an issue: GitHub.