siyuan-note/siyuan · error
must be a boolean
Error message
%s must be a boolean
What it means
The settings 'autoFillNow', 'fillSpecificTime', and 'includeTime' toggle boolean flags on date-family fields. UpdateAttributeViewKeyConfig type-asserts the config value to bool; a non-boolean value (string "true", number, nil) fails the assertion and produces '<setting> must be a boolean'.
Solutions
- Send a real boolean: {"autoFillNow": true} not {"autoFillNow": "true"}.
- In JavaScript, coerce with Boolean(value) or '===' checks before building the config map.
- If the source is user input, parse it (e.g. value === "true") before passing it as the config value.
Example fix
// before
{"autoFillNow": "true"}
// after
{"autoFillNow": true} Defensive patterns
Strategy: type-guard
Validate before calling
// JS: ensure boolean before sending if (typeof flag !== "boolean") throw new TypeError(setting + " must be a boolean");
Type guard
function isBool(v) { return typeof v === "boolean"; } Try / catch
try { await updateKeyConfig(avID, keyID, { [setting]: flag }); } catch (e) { if (String(e).includes("must be a boolean")) { throw new TypeError("Fix payload: " + setting + " must be true/false, got " + typeof flag); } throw e; } Prevention
- Use JSON booleans, never "true"/"false" strings or 0/1
- Add a schema (e.g. zod/ajv) check for config payloads
- Coerce user input with strict === "true" checks, not truthiness
When it happens
Trigger: Calling UpdateAttributeViewKeyConfig with {"autoFillNow": "true"}, {"includeTime": 1}, {"fillSpecificTime": nil}, or any JSON value that is not a JSON boolean for one of these three settings.
Common situations: Clients built from JS habits send the string "true"/"false" or 0/1 instead of true/false in the JSON body; a template-generated payload interpolates the flag as text.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- block [ ] is not an instance of attribute view [ ]
- date display format is only available for date fields
- filters must be an array
- invalid attribute view column widths
- invalid attribute view field template
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/5ce006236a8a3974.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/attribute_view_key_config.go:87
}
return updateAttributeViewColNumberFormat(op)
case "dateFormat":
return setAttributeViewColDateFormat(op)
case "template":
if av.KeyTypeTemplate != key.Type {
return errors.New("template requires a template field; use renderTemplate for other fields")
}
return updateAttributeViewColTemplate(op)
case "renderTemplate":
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)View on GitHub (pinned to 9f775e8a12)