siyuan-note/siyuan · error
new item template field [%s] current time mode requires date
Error message
new item template field [%s] current time mode requires date type
What it means
fieldValue.Mode is NewItemFieldValueCurrentTime but the bound key's type is not KeyTypeDate. CurrentTime mode writes the wall-clock time at row creation, which is only meaningful for date columns, so the validator refuses it for any other type.
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 251596fc0d)
Solutions
- Use NewItemFieldValueStatic with an explicit value for non-date fields.
- If you want auto-time on a Date column, confirm key.Type == KeyTypeDate before setting Mode = CurrentTime.
- Re-save the template after any column-type change so the validator can re-check.
Example fix
// before — CurrentTime on a Number column
FieldValues["num-key"] = &av.NewItemFieldValue{Mode: av.NewItemFieldValueCurrentTime}
// after
FieldValues["num-key"] = &av.NewItemFieldValue{Mode: av.NewItemFieldValueStatic, Value: &av.Value{Number: &av.ValueNumber{Content: 0}}} Defensive patterns
Strategy: validation
Validate before calling
if fieldValue.Mode == av.NewItemFieldValueCurrentTime && key.Type != av.KeyTypeDate {
return fmt.Errorf("current time mode requires date type")
} Prevention
- Only set Mode = CurrentTime on KeyTypeDate columns.
- For non-date fields, use Static with an explicit value.
- Re-validate templates after a column-type change.
When it happens
Trigger: A column was changed from Date to another type after the template was configured; client sets CurrentTime on a non-date field; import with a type/mode mismatch.
Common situations: Schema migration that changed column type without re-validating templates; client-side type mismatch; stale cached schema.
Related errors
- invalid new item template field value mode [%s]
- date value is missing
- new item templates config is nil
- new item template name is empty
- invalid new item template id [%s]
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/0efcecef1d5123d1.
Report an issue: GitHub.