siyuan-note/siyuan · error
requires a date field
Error message
%s requires a date field
What it means
The settings 'autoFillNow' (fill with current time on row creation) and 'fillSpecificTime' (fill a specific time) only apply to fields of type 'date'. For non-date fields, UpdateAttributeViewKeyConfig returns '<setting> requires a date field' naming the attempted setting.
Solutions
- Target a field whose type is 'date' for autoFillNow/fillSpecificTime.
- Verify key.Type via the attribute view API before sending the setting.
- For created/updated fields use 'includeTime' instead of autoFillNow/fillSpecificTime.
Example fix
// before (text field)
UpdateAttributeViewKeyConfig(avID, textKeyID, {"autoFillNow": true})
// after
UpdateAttributeViewKeyConfig(avID, dateKeyID, {"autoFillNow": true}) Defensive patterns
Strategy: validation
Validate before calling
// JS: autoFillNow/fillSpecificTime only for date fields if (setting !== "includeTime" && key.type !== "date") throw new Error(setting + " requires a date field");
Type guard
function isDateField(key) { return key && key.type === "date"; } Try / catch
try { await updateKeyConfig(avID, keyID, { [setting]: true }); } catch (e) { if (String(e).includes("requires a date field")) { console.warn("skipped", setting, "for", keyID); } else { throw e; } } Prevention
- Gate autoFillNow/fillSpecificTime behind a key.type === "date" check
- Do not reuse date-field settings for created/updated fields
- Keep field-type metadata in sync after type changes
When it happens
Trigger: Calling UpdateAttributeViewKeyConfig with {"autoFillNow": true} or {"fillSpecificTime": true} where key.Type != av.KeyTypeDate (e.g. a text, number, or created/updated field).
Common situations: Bulk field-config scripts apply the date fill options to every field; a caller confuses 'created'/'updated' fields (which use includeTime) with 'date' fields (which use autoFillNow/fillSpecificTime).
Understand the failure class
Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.
Related errors
- includeTime requires a created or updated field
- numberFormat requires a number field and a supported format
- template requires a template field; use renderTemplate for…
- at least one visible view is required
- attribute view custom color index
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/c8d2150fa2725ba2.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/attribute_view_key_config.go:100
return updateAttributeViewColTemplate(op)
}
case "autoFillNow", "fillSpecificTime", "includeTime":
flag, ok := value.(bool)
if !ok {
return fmt.Errorf("%s must be a boolean", setting)
}
op.Data = flag
if "includeTime" == setting {
switch key.Type {
case av.KeyTypeCreated:
return setAttrViewCreatedIncludeTime(op)
case av.KeyTypeUpdated:
return setAttrViewUpdatedIncludeTime(op)
}
return errors.New("includeTime requires a created or updated field")
}
if av.KeyTypeDate != key.Type {
return fmt.Errorf("%s requires a date field", setting)
}
if "autoFillNow" == setting {
return setAttributeViewColDateFillCreated(op)
}
return setAttrViewColDateFillSpecificTime(op)
case "options", "optionUpdate", "optionRemove":
if av.KeyTypeSelect != key.Type && av.KeyTypeMSelect != key.Type {
return errors.New("option settings require a select or mSelect field")
}
return updateAttributeViewKeyOptions(attrView, key, op, setting, value)
case "relation":
return updateAttributeViewKeyRelation(key, op, value)
case "rollup":
return updateAttributeViewKeyRollup(attrView, key, op, value)
case "relationFilters", "rollupFilters":
filters, ok := value.([]any)
if !ok {
return errors.New("filters must be an array")View on GitHub (pinned to 9f775e8a12)