siyuan-note/siyuan · error
includeTime requires a created or updated field
Error message
includeTime requires a created or updated field
What it means
'includeTime' toggles whether created/updated timestamps record a time-of-day component, so it is only valid on fields of type 'created' or 'updated'. For any other field type UpdateAttributeViewKeyConfig returns 'includeTime requires a created or updated field'.
Solutions
- Apply includeTime only to created/updated fields; for plain date fields use the date settings ('autoFillNow', 'fillSpecificTime') instead.
- Check key.Type before the call and skip or redirect the setting per field type.
- If a 'date' field should carry time, configure its date format ('dateFormat' setting) rather than includeTime.
Example fix
// before (date field)
UpdateAttributeViewKeyConfig(avID, dateKeyID, {"includeTime": true})
// after
UpdateAttributeViewKeyConfig(avID, createdKeyID, {"includeTime": true}) Defensive patterns
Strategy: validation
Validate before calling
// JS: includeTime only for created/updated fields
const ok = key.type === "created" || key.type === "updated";
if (!ok) throw new Error("includeTime requires a created or updated field"); Type guard
function supportsIncludeTime(key) { return ["created", "updated"].includes(key.type); } Try / catch
try { await updateKeyConfig(avID, keyID, { includeTime: true }); } catch (e) { if (String(e).includes("includeTime requires")) { console.warn("skipped includeTime for", keyID); } else { throw e; } } Prevention
- Map settings to allowed field types in one table and consult it before calls
- Remember: date fields use autoFillNow/fillSpecificTime, created/updated use includeTime
- Test config scripts against a sample database with one field of each type
When it happens
Trigger: Calling UpdateAttributeViewKeyConfig(avID, keyID, {"includeTime": true}) where key.Type is not KeyTypeCreated and not KeyTypeUpdated (e.g. a 'date', 'text', or 'number' field).
Common situations: A UI or script applies includeTime uniformly to all date-like fields including plain 'date' fields, assuming date and created/updated share the same options; automation written against an older schema where date fields also supported includeTime.
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
- numberFormat requires a number field and a supported format
- requires a date field
- 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/d568dd1c297c4d08.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/attribute_view_key_config.go:97
if av.KeyTypeTemplate == key.Type {
return errors.New("use template for a template field")
}
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":View on GitHub (pinned to 9f775e8a12)