weaviate/weaviate · error

invalid 'where' filter

Error message

invalid 'where' filter

What it means

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.

Source

Thrown at usecases/traverser/traverser_get.go:54

		// we currently have no concept of error status code or typed errors in
		// GraphQL, so there is no other way then to send a message containing what
		// we want to convey
		return nil, enterrors.NewErrRateLimit()
	}

	defer t.ratelimiter.Dec()

	t.metrics.QueriesGetInc(params.ClassName)
	defer t.metrics.QueriesGetDec(params.ClassName)
	defer t.metrics.QueriesObserveDuration(params.ClassName, before.UnixMilli())

	if err := t.probeForRefDepthLimit(params.Properties); err != nil {
		return nil, err
	}

	// validate here, because filters can contain references that need to be authorized
	if err := t.validateFilters(ctx, principal, params.Filters); err != nil {
		return nil, errors.Wrap(err, "invalid 'where' filter")
	}

	certainty := ExtractCertaintyFromParams(params)
	if certainty != 0 || params.AdditionalProperties.Certainty {
		// if certainty is provided as input, we must ensure
		// that the vector index is configured to use cosine
		// distance
		if err := t.validateGetDistanceParams(params); err != nil {
			return nil, err
		}
	}

	return t.explorer.GetClass(ctx, params)
}

// probeForRefDepthLimit checks to ensure reference nesting depth doesn't exceed the limit
// provided by QUERY_CROSS_REFERENCE_DEPTH_LIMIT
func (t *Traverser) probeForRefDepthLimit(props search.SelectProperties) error {

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Inspect the wrapped inner error message for the failing operand
  2. Confirm all filter paths (including nested reference paths like ["refProp","Target","prop"]) match GET /v1/schema
  3. Grant the principal READ access (CollectionsMetadata) to every referenced collection
  4. Validate the filter client-side with the SDK's schema-aware filter builder before sending

Example fix

// before: operator mismatch (Equal with int on text prop)
filter := filters.NewFilters(path, "Equal", 42, schema.DataTypeText)
// after: match operator/value to data type
filter := filters.NewFilters(path, "Equal", "hello", schema.DataTypeText)
Defensive patterns

Strategy: validation

Validate before calling

# Python: validate where-filter paths against the live schema
schema = client.schema.get()
valid_classes = {c['class'] for c in schema['classes']}
for path in where_filter_paths:  # e.g. ["hasArticle","Article","title"]
    if len(path) > 1 and path[1] not in valid_classes:
        raise ValueError(f"filter references unknown class {path[1]}")

Type guard

def class_exists(name: str, schema: dict) -> bool:
    return any(c['class'] == name for c in schema.get('classes', []))

Prevention

When it happens

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

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

Related errors


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