{"record":{"id":"4b5f0716f8e46f53","repo":"weaviate/weaviate","slug":"invalid-where-filter-w-4b5f07","errorCode":null,"errorMessage":"invalid 'where' filter: %w","messagePattern":"invalid 'where' filter: %w","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"adapters/handlers/rest/search/request.go","lineNumber":897,"sourceCode":"\treturn maxDepth + 1\n}\n\nfunc parseWhere(where *models.WhereFilter, className string, namespacesEnabled bool,\n\tprincipal *models.Principal, getClass classGetterFunc,\n) (*filters.LocalFilter, *APIError) {\n\tif where == nil {\n\t\treturn nil, nil\n\t}\n\n\tfilter, err := filterext.Parse(where, className, namespacesEnabled, principal)\n\tif err != nil {\n\t\treturn nil, &APIError{Status: http.StatusBadRequest, Err: err}\n\t}\n\n\tif err := filters.ValidateFilters(getClass, filter); err != nil {\n\t\tapiErr := statusFromError(err)\n\t\tif apiErr.Status == http.StatusInternalServerError {\n\t\t\tapiErr = &APIError{Status: http.StatusBadRequest, Err: fmt.Errorf(\"invalid 'where' filter: %w\", err)}\n\t\t}\n\t\treturn nil, apiErr\n\t}\n\n\treturn filter, nil\n}\n\n// property adapts *models.Property to schema.PropertyInterface for the\n// shared nested-property selection.\ntype property struct {\n\t*models.Property\n}\n\nfunc (p *property) GetName() string {\n\treturn p.Name\n}\n\nfunc (p *property) GetNestedProperties() []*models.NestedProperty {","sourceCodeStart":879,"sourceCodeEnd":915,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/handlers/rest/search/request.go#L879-L915","documentation":"parseWhere validates where-filters with filters.ValidateFilters. Validation errors that would default to 500 are reclassified as a 400 with this 'invalid where filter' message, since a failing filter contract is the caller's fault, not a server fault.","triggerScenarios":"Aggregate or Get requests with a where clause using an unknown operator, wrong operand types for the property, filtering on a non-indexed/non-existent property, or a structurally malformed filter.","commonSituations":"Using Equal on a nested/reference path incorrectly; applying text operators (Like) to int properties; filter built by hand-rolled JSON missing operator or operands; property renamed in schema but query not updated.","solutions":["Validate the where clause: correct operator name, value type matching property datatype, and existing indexed property path","Rebuild the filter using an SDK/client builder to guarantee schema compliance","GET /v1/schema to confirm property names and datatypes before filtering"],"exampleFix":"// before (operand type mismatch: int property with text value)\n{\"path\":[\"price\"],\"operator\":\"like\",\"valueText\":\"10*\"}\n// after\n{\"path\":[\"price\"],\"operator\":\"greaterThan\",\"valueInt\":10}","handlingStrategy":"validation","validationCode":"// ensure filter is schema-conformant before sending\nschema, _ := client.Schema().Getter().Do(ctx)\n_ = schema // check property exists and operator matches datatype:\n// e.g. use valueInt for int props, valueText for text ops like Like","typeGuard":null,"tryCatchPattern":"var apiErr *graphql.ApiError\nif errors.As(err, &apiErr) && strings.Contains(apiErr.Error(), \"invalid 'where' filter\") {\n    // fix the filter client-side; this is a 400, not retryable\n}","preventionTips":["Build filters with SDK builders, not raw JSON strings","Validate operand types against property datatypes from /v1/schema","Update filters whenever properties are renamed"],"tags":["rest","filter","where-clause","request-validation"],"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"}