{"record":{"id":"9115c320822258fa","repo":"weaviate/weaviate","slug":"invalid-where-filter-9115c3","errorCode":null,"errorMessage":"invalid 'where' filter","messagePattern":"invalid 'where' filter","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"usecases/traverser/traverser_get.go","lineNumber":54,"sourceCode":"\t\t// we currently have no concept of error status code or typed errors in\n\t\t// GraphQL, so there is no other way then to send a message containing what\n\t\t// we want to convey\n\t\treturn nil, enterrors.NewErrRateLimit()\n\t}\n\n\tdefer t.ratelimiter.Dec()\n\n\tt.metrics.QueriesGetInc(params.ClassName)\n\tdefer t.metrics.QueriesGetDec(params.ClassName)\n\tdefer t.metrics.QueriesObserveDuration(params.ClassName, before.UnixMilli())\n\n\tif err := t.probeForRefDepthLimit(params.Properties); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// validate here, because filters can contain references that need to be authorized\n\tif err := t.validateFilters(ctx, principal, params.Filters); err != nil {\n\t\treturn nil, errors.Wrap(err, \"invalid 'where' filter\")\n\t}\n\n\tcertainty := ExtractCertaintyFromParams(params)\n\tif certainty != 0 || params.AdditionalProperties.Certainty {\n\t\t// if certainty is provided as input, we must ensure\n\t\t// that the vector index is configured to use cosine\n\t\t// distance\n\t\tif err := t.validateGetDistanceParams(params); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn t.explorer.GetClass(ctx, params)\n}\n\n// probeForRefDepthLimit checks to ensure reference nesting depth doesn't exceed the limit\n// provided by QUERY_CROSS_REFERENCE_DEPTH_LIMIT\nfunc (t *Traverser) probeForRefDepthLimit(props search.SelectProperties) error {","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/traverser/traverser_get.go#L36-L72","documentation":"GetClass wraps any validateFilters failure with \"invalid 'where' filter\". Before executing a Get query, Weaviate validates the where-filter because filters can traverse cross-references; each referenced class must resolve in the schema and the principal must be authorized to read it. The wrapped inner error carries the precise reason.","triggerScenarios":"A Get query (GraphQL or gRPC search) whose where filter references a nonexistent class/property, uses a mismatched operator/value type for the property's data type, or references a class the caller cannot read (validated via authorizer.Authorize + filters.ValidateFilters in validateFilters).","commonSituations":"Stale client-side schema caches after class renames; cross-reference filters pointing at deleted collections; restricted API keys querying reference targets they lack access to; hand-constructed GraphQL where strings with typos.","solutions":["Inspect the wrapped inner error message for the failing operand","Confirm all filter paths (including nested reference paths like [\"refProp\",\"Target\",\"prop\"]) match GET /v1/schema","Grant the principal READ access (CollectionsMetadata) to every referenced collection","Validate the filter client-side with the SDK's schema-aware filter builder before sending"],"exampleFix":"// before: operator mismatch (Equal with int on text prop)\nfilter := filters.NewFilters(path, \"Equal\", 42, schema.DataTypeText)\n// after: match operator/value to data type\nfilter := filters.NewFilters(path, \"Equal\", \"hello\", schema.DataTypeText)","handlingStrategy":"validation","validationCode":"# Python: validate where-filter paths against the live schema\nschema = client.schema.get()\nvalid_classes = {c['class'] for c in schema['classes']}\nfor path in where_filter_paths:  # e.g. [\"hasArticle\",\"Article\",\"title\"]\n    if len(path) > 1 and path[1] not in valid_classes:\n        raise ValueError(f\"filter references unknown class {path[1]}\")","typeGuard":"def class_exists(name: str, schema: dict) -> bool:\n    return any(c['class'] == name for c in schema.get('classes', []))","tryCatchPattern":null,"preventionTips":["Validate reference filter paths against /v1/schema before querying","Match operator and value type to the property's dataType","Refresh cached schemas after any schema migration","Check API key permissions for nested reference targets"],"tags":["graphql","filter-validation","authorization"],"backgroundTag":"invalid-where-filter","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}