siyuan-note/siyuan · error

unsupported value type

Error message

unsupported value type [%s]

What it means

normalizeNewItemTemplateValue switches on the attribute-view key's Type; any type not among the supported template value types (text, number, date, select/mSelect, URL, email, phone, mAsset, checkbox, relation) falls through to the default branch and returns 'unsupported value type [%s]'. Types like block, template, created, updated, or rollup are computed fields and cannot be supplied in new-item templates.

Solutions

  1. Remove the value entry for the computed key type from the template
  2. Only supply values for editable column types (text, number, date, select, URL, email, phone, mAsset, checkbox, relation)
  3. Fix the type string if it is a typo
  4. Extend normalizeNewItemTemplateValue if a new key type must be template-supported

Example fix

// before
{"type":"rollup","...}
// after
// remove the rollup value; it is computed automatically
Defensive patterns

Strategy: validation

Validate before calling

switch key.Type {
case av.KeyTypeBlock, av.KeyTypeTemplate, av.KeyTypeCreated, av.KeyTypeUpdated, av.KeyTypeRollup:
    return fmt.Errorf("computed type %s cannot be templated", key.Type)
}

Type guard

func templateable(keyType av.KeyType) bool {
    switch keyType {
    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: Calling PruneInvalidNewItemTemplateFieldValues or normalizeNewItemTemplateFieldValues with a Key whose Type is a computed/rollup type (block, template, created, updated, rollup) or any unrecognized/typo type string.

Common situations: Templates that try to preset computed columns; schema migrations introducing a new key type before the template normalizer was updated; typos in type strings in hand-edited templates.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/fb155afdcb20505e. Report an issue: GitHub.

Appendix: source

Thrown at kernel/av/new_item_template.go:429

		value.MAsset = assets
		value.Text, value.Number, value.Date, value.MSelect, value.URL, value.Email, value.Phone, value.Checkbox, value.Relation = nil, nil, nil, nil, nil, nil, nil, nil, nil
	case KeyTypeCheckbox:
		if nil == value.Checkbox {
			return nil, errors.New("checkbox value is missing")
		}
		value.Text, value.Number, value.Date, value.MSelect, value.URL, value.Email, value.Phone, value.MAsset, value.Relation = nil, nil, nil, nil, nil, nil, nil, nil, nil
	case KeyTypeRelation:
		if nil == value.Relation {
			return nil, errors.New("relation value is missing")
		}
		for _, blockID := range value.Relation.BlockIDs {
			if !ast.IsNodeIDPattern(blockID) {
				return nil, fmt.Errorf("invalid relation block ID [%s]", blockID)
			}
		}
		value.Text, value.Number, value.Date, value.MSelect, value.URL, value.Email, value.Phone, value.MAsset, value.Checkbox = nil, nil, nil, nil, nil, nil, nil, nil, nil
	default:
		return nil, fmt.Errorf("unsupported value type [%s]", key.Type)
	}
	value.Block, value.Template, value.Created, value.Updated, value.Rollup = nil, nil, nil, nil, nil
	value.ID = ""
	value.KeyID = ""
	value.BlockID = ""
	value.Type = key.Type
	value.IsDetached = false
	value.CreatedAt = 0
	value.UpdatedAt = 0
	value.IsRenderAutoFill = false
	if nil != value.Number {
		value.Number.Format = key.NumberFormat
		value.Number.FormattedContent = ""
	}
	if nil != value.Date {
		value.Date.FormattedContent = ""
	}
	if nil != value.Created {

View on GitHub (pinned to 9f775e8a12)