usememos/memos · error
tag attribute is not configured
Error message
tag attribute is not configured
What it means
The special-cased tag IN [...] rendering resolves the 'tag' alias through the schema to find the backing JSON attribute column. If the schema has no alias named "tag" configured (ResolveAlias("tag") returns false), there is no column to query and this error is returned.
Source
Thrown at internal/filter/render.go:445
return r.renderTagInList(cond.Values)
}
field, ok := r.schema.Field(fieldRef.Name)
if !ok {
return renderResult{}, errors.Errorf("unknown field %q", fieldRef.Name)
}
if field.Kind != FieldKindScalar {
return renderResult{}, errors.Errorf("field %q does not support IN()", fieldRef.Name)
}
return r.renderScalarInCondition(field, cond.Values)
}
func (r *renderer) renderTagInList(values []ValueExpr) (renderResult, error) {
field, ok := r.schema.ResolveAlias("tag")
if !ok {
return renderResult{}, errors.New("tag attribute is not configured")
}
conditions := make([]string, 0, len(values))
for _, v := range values {
lit, err := expectLiteral(v)
if err != nil {
return renderResult{}, err
}
str, ok := lit.(string)
if !ok {
return renderResult{}, errors.New("tags must be compared with string literals")
}
condition, err := r.renderJSONListContains(field, str)
if err != nil {
return renderResult{}, err
}
conditions = append(conditions, condition.sql)View on GitHub (pinned to 14d757ce1f)
Solutions
- Use the schema definition that registers the tag virtual alias (the default memo schema) when rendering tag filters
- If using a custom schema, add a virtual alias 'tag' mapped to a JSON/existing attribute before rendering
- Pre-validate filters against the schema and reject tag references when the alias is absent
Defensive patterns
Strategy: validation
Validate before calling
// Before rendering tag filters, confirm the schema provides the tag alias
if _, ok := schema.ResolveAlias("tag"); !ok {
return errors.New("this schema has no tag attribute; tag filters are unsupported")
} Try / catch
if _, err := r.Render(cond); err != nil {
if strings.Contains(err.Error(), "tag attribute is not configured") {
// skip tag filtering or fall back to unfiltered query for this store
return ErrTagUnsupported
}
return err
} Prevention
- Register the tag virtual alias in any custom Schema used for rendering
- Fail fast at filter-parse time when the schema lacks fields referenced by the filter
- Keep schema definitions in sync when renaming attributes
When it happens
Trigger: Calling the renderer with a custom Schema that omits the tag alias, while the filter contains tag in [...] or tag.exists(...). Typical when reusing the filter package with a reduced/alternative schema (e.g. a store without the tag attribute).
Common situations: Embedding internal/filter with a custom Schema for tests or another entity type; schema drift after renaming the tag attribute without updating alias configuration.
Related errors
- comparison must start with a field reference or supported fu
- size() expects one argument
- size() argument must be a field
- IN operator requires a field on the left-hand side
- tags must be compared with string literals
AI-assisted analysis of usememos/memos@14d757ce1f (2026-08-15).
Data as JSON: /api/errors/0f764b978ba819f4.
Report an issue: GitHub.