weaviate/weaviate · error

invalid 'where' filter: %w

Error message

invalid 'where' filter: %w

What it means

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.

Source

Thrown at adapters/handlers/rest/search/request.go:897

	return maxDepth + 1
}

func parseWhere(where *models.WhereFilter, className string, namespacesEnabled bool,
	principal *models.Principal, getClass classGetterFunc,
) (*filters.LocalFilter, *APIError) {
	if where == nil {
		return nil, nil
	}

	filter, err := filterext.Parse(where, className, namespacesEnabled, principal)
	if err != nil {
		return nil, &APIError{Status: http.StatusBadRequest, Err: err}
	}

	if err := filters.ValidateFilters(getClass, filter); err != nil {
		apiErr := statusFromError(err)
		if apiErr.Status == http.StatusInternalServerError {
			apiErr = &APIError{Status: http.StatusBadRequest, Err: fmt.Errorf("invalid 'where' filter: %w", err)}
		}
		return nil, apiErr
	}

	return filter, nil
}

// property adapts *models.Property to schema.PropertyInterface for the
// shared nested-property selection.
type property struct {
	*models.Property
}

func (p *property) GetName() string {
	return p.Name
}

func (p *property) GetNestedProperties() []*models.NestedProperty {

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Validate the where clause: correct operator name, value type matching property datatype, and existing indexed property path
  2. Rebuild the filter using an SDK/client builder to guarantee schema compliance
  3. GET /v1/schema to confirm property names and datatypes before filtering

Example fix

// before (operand type mismatch: int property with text value)
{"path":["price"],"operator":"like","valueText":"10*"}
// after
{"path":["price"],"operator":"greaterThan","valueInt":10}
Defensive patterns

Strategy: validation

Validate before calling

// ensure filter is schema-conformant before sending
schema, _ := client.Schema().Getter().Do(ctx)
_ = schema // check property exists and operator matches datatype:
// e.g. use valueInt for int props, valueText for text ops like Like

Try / catch

var apiErr *graphql.ApiError
if errors.As(err, &apiErr) && strings.Contains(apiErr.Error(), "invalid 'where' filter") {
    // fix the filter client-side; this is a 400, not retryable
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04). Data as JSON: /api/errors/4b5f0716f8e46f53. Report an issue: GitHub.