siyuan-note/siyuan · error

new item template field [%s] value is invalid

Error message

new item template field [%s] value is invalid

What it means

Error "new item template field [%s] value is invalid" thrown in siyuan-note/siyuan.

Source

Thrown at kernel/model/attribute_view_new_item.go:539

	for keyID, fieldValue := range itemTemplate.FieldValues {
		key, getErr := attrView.GetKey(keyID)
		if nil != getErr || nil == key {
			return nil, fmt.Errorf("new item template field [%s] not found", keyID)
		}
		var value *av.Value
		switch fieldValue.Mode {
		case av.NewItemFieldValueCurrentTime:
			if av.KeyTypeDate != key.Type {
				return nil, fmt.Errorf("new item template field [%s] current time value is invalid", keyID)
			}
			isNotTime := true
			if nil != key.Date {
				isNotTime = !key.Date.FillSpecificTime
			}
			value = &av.Value{Type: av.KeyTypeDate, Date: av.NewFormattedValueDate(createdAt.UnixMilli(), 0, av.DateFormatNone, isNotTime, false)}
		case av.NewItemFieldValueStatic:
			if nil == fieldValue.Value || fieldValue.Value.Type != key.Type {
				return nil, fmt.Errorf("new item template field [%s] value is invalid", keyID)
			}
			value = fieldValue.Value.Clone()
			if av.KeyTypeRelation == key.Type {
				filterNewItemTemplateRelationValue(attrView, key, value)
				if nil == value.Relation || 0 == len(value.Relation.BlockIDs) {
					continue
				}
			}
		default:
			return nil, fmt.Errorf("new item template field [%s] value mode is invalid", keyID)
		}
		ret[keyID] = value
	}
	return
}

func filterNewItemTemplateRelationValue(attrView *av.AttributeView, key *av.Key, value *av.Value) {
	if nil == key.Relation || nil == value.Relation {

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Provide a value compatible with the field's column type (e.g. a number for number fields, a valid date for date fields).
  2. Check the kernel log for the validation detail and correct the template value.

Example fix

Fix the template so a select field references an existing option and a date field holds an ISO date string.

When it happens

Trigger: A new-item template contains a value that fails validation for the target field's type.

Common situations: Occurs when a new-item template field value fails validation against the field type, for example text in a number field or an unknown select option.


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