siyuan-note/siyuan · error
date value is missing
Error message
date value is missing
What it means
normalizeNewItemTemplateValue for KeyTypeDate requires value.Date != nil — the Date sub-struct holds the timestamp and its formatted content. A Static-mode value on a Date column that omits the Date pointer is rejected; for auto-time behavior use NewItemFieldValueCurrentTime instead.
Source
Thrown at kernel/av/new_item_template.go:371
return nil
}
func normalizeNewItemTemplateValue(value *Value, key *Key) (*Value, error) {
value = value.Clone()
switch key.Type {
case KeyTypeText:
if nil == value.Text {
return nil, errors.New("text value is missing")
}
value.Number, value.Date, value.MSelect, value.URL, value.Email, value.Phone, value.MAsset, value.Checkbox, value.Relation = nil, nil, nil, nil, nil, nil, nil, nil, nil
case KeyTypeNumber:
if nil == value.Number {
return nil, errors.New("number value is missing")
}
value.Text, value.Date, value.MSelect, value.URL, value.Email, value.Phone, value.MAsset, value.Checkbox, value.Relation = nil, nil, nil, nil, nil, nil, nil, nil, nil
case KeyTypeDate:
if nil == value.Date {
return nil, errors.New("date value is missing")
}
value.Text, value.Number, value.MSelect, value.URL, value.Email, value.Phone, value.MAsset, value.Checkbox, value.Relation = nil, nil, nil, nil, nil, nil, nil, nil, nil
case KeyTypeSelect, KeyTypeMSelect:
var selections []*ValueSelect
for _, selection := range value.MSelect {
if nil != selection && "" != strings.TrimSpace(selection.Content) {
selections = append(selections, selection)
}
}
if KeyTypeSelect == key.Type && 1 < len(selections) {
selections = selections[:1]
}
value.MSelect = selections
value.Text, value.Number, value.Date, value.URL, value.Email, value.Phone, value.MAsset, value.Checkbox, value.Relation = nil, nil, nil, nil, nil, nil, nil, nil, nil
case KeyTypeURL:
if nil == value.URL {
return nil, errors.New("URL value is missing")
}View on GitHub (pinned to 251596fc0d)
Solutions
- Set Value.Date = &av.ValueDate{Content: <timestamp>, IsNotDuration: ...} for an explicit date.
- If you want creation-time auto-fill, switch fieldValue.Mode to NewItemFieldValueCurrentTime instead.
- Match the Value sub-pointer to key.Type exactly.
Example fix
// before
&av.NewItemFieldValue{Mode: av.NewItemFieldValueStatic, Value: &av.Value{}}
// after
&av.NewItemFieldValue{Mode: av.NewItemFieldValueCurrentTime} Defensive patterns
Strategy: type-guard
Validate before calling
if key.Type == av.KeyTypeDate && value.Date == nil {
// either supply an explicit date or switch to CurrentTime mode
return errors.New("date value is missing; use CurrentTime mode or supply Value.Date")
} Type guard
func hasDateValue(v *av.Value) bool { return v != nil && v.Date != nil } Prevention
- For auto-fill at creation time, use Mode = NewItemFieldValueCurrentTime instead of Static.
- For explicit dates, set Value.Date with a valid timestamp.
- Match the Value sub-pointer to key.Type exactly.
When it happens
Trigger: Static mode on a Date column but Value.Date is nil; client intended auto-time but used Static with an empty value; type mismatch in an import.
Common situations: Partial Value from a client; confusion between Static (explicit date) and CurrentTime (auto-fill) modes.
Related errors
- new item template field [%s] current time mode requires date
- new item template field [%s] value is invalid: %w
- text value is missing
- number value is missing
- URL value is missing
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/a8f8288c1432ab2f.
Report an issue: GitHub.