siyuan-note/siyuan · error
new item template field
Error message
new item template field [%s] current time mode requires date type
What it means
The NewItemFieldValueCurrentTime mode is only meaningful for date-typed fields. When a field value uses the current-time mode on a key whose Type is not KeyTypeDate, normalizeNewItemTemplateFieldValues rejects the configuration. The current-time mode injects the creation timestamp, which requires a date field to store it.
Solutions
- Switch the field value's Mode to NewItemFieldValueStatic for non-date fields
- Change the target key to a date-typed field before using NewItemFieldValueCurrentTime
- Remove the FieldValues entry if neither applies
Example fix
// before
fv.Mode = av.NewItemFieldValueCurrentTime // key is text
// after
if key.Type == av.KeyTypeDate {
fv.Mode = av.NewItemFieldValueCurrentTime
} else {
fv.Mode = av.NewItemFieldValueStatic
} Defensive patterns
Strategy: validation
Validate before calling
key, err := av.GetKey(keyID)
if err == nil && fv.Mode == av.NewItemFieldValueCurrentTime && key.Type != av.KeyTypeDate {
fv.Mode = av.NewItemFieldValueStatic
} Prevention
- Only offer the current-time mode in UIs when the target field is a date field
- Reset the mode to static whenever a field's type changes away from date
When it happens
Trigger: Calling SetNewItemTemplates with FieldValues[keyID].Mode = NewItemFieldValueCurrentTime where the referenced key's Type is not KeyTypeDate (e.g. a text or number field).
Common situations: Selecting 'current time' fill mode for a non-date field in a plugin UI; a field's type changed from date to text after the template was saved; copying a field-value config to a differently-typed field.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- date display format is only available for date fields
- invalid attribute view source
- invalid attribute view source
- invalid card field full row value
- must be a string
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/0efcecef1d5123d1.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/av/new_item_template.go:325
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)
if nil != err {
return fmt.Errorf("new item template field [%s] value is invalid: %w", keyID, err)
}
if KeyTypeSelect == key.Type || KeyTypeMSelect == key.Type {
for _, selection := range fieldValue.Value.MSelect {
if nil != selection && nil == key.GetOption(selection.Content) {
return fmt.Errorf("new item template field [%s] option [%s] not found", keyID, selection.Content)
}
}
}
default:View on GitHub (pinned to 9f775e8a12)