{"record":{"id":"0f764b978ba819f4","repo":"usememos/memos","slug":"tag-attribute-is-not-configured","errorCode":null,"errorMessage":"tag attribute is not configured","messagePattern":"tag attribute is not configured","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"internal/filter/render.go","lineNumber":445,"sourceCode":"\t\treturn r.renderTagInList(cond.Values)\n\t}\n\n\tfield, ok := r.schema.Field(fieldRef.Name)\n\tif !ok {\n\t\treturn renderResult{}, errors.Errorf(\"unknown field %q\", fieldRef.Name)\n\t}\n\n\tif field.Kind != FieldKindScalar {\n\t\treturn renderResult{}, errors.Errorf(\"field %q does not support IN()\", fieldRef.Name)\n\t}\n\n\treturn r.renderScalarInCondition(field, cond.Values)\n}\n\nfunc (r *renderer) renderTagInList(values []ValueExpr) (renderResult, error) {\n\tfield, ok := r.schema.ResolveAlias(\"tag\")\n\tif !ok {\n\t\treturn renderResult{}, errors.New(\"tag attribute is not configured\")\n\t}\n\n\tconditions := make([]string, 0, len(values))\n\tfor _, v := range values {\n\t\tlit, err := expectLiteral(v)\n\t\tif err != nil {\n\t\t\treturn renderResult{}, err\n\t\t}\n\t\tstr, ok := lit.(string)\n\t\tif !ok {\n\t\t\treturn renderResult{}, errors.New(\"tags must be compared with string literals\")\n\t\t}\n\n\t\tcondition, err := r.renderJSONListContains(field, str)\n\t\tif err != nil {\n\t\t\treturn renderResult{}, err\n\t\t}\n\t\tconditions = append(conditions, condition.sql)","sourceCodeStart":427,"sourceCodeEnd":463,"githubUrl":"https://github.com/usememos/memos/blob/14d757ce1fb31c78590f374bc042f8dbedbc20d7/internal/filter/render.go#L427-L463","documentation":"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.","triggerScenarios":"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).","commonSituations":"Embedding internal/filter with a custom Schema for tests or another entity type; schema drift after renaming the tag attribute without updating alias configuration.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before rendering tag filters, confirm the schema provides the tag alias\nif _, ok := schema.ResolveAlias(\"tag\"); !ok {\n    return errors.New(\"this schema has no tag attribute; tag filters are unsupported\")\n}","typeGuard":null,"tryCatchPattern":"if _, err := r.Render(cond); err != nil {\n    if strings.Contains(err.Error(), \"tag attribute is not configured\") {\n        // skip tag filtering or fall back to unfiltered query for this store\n        return ErrTagUnsupported\n    }\n    return err\n}","preventionTips":["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"],"tags":["cel","filter","renderer","schema","configuration"],"backgroundTag":null,"analyzedSha":"14d757ce1fb31c78590f374bc042f8dbedbc20d7","analyzedAt":"2026-08-15T09:27:36.538Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}