weaviate/weaviate · error

empty where

Error message

empty where

What it means

ValidateFilters rejects a nil LocalFilter with "empty where". The filter traverser and aggregation APIs call it to guarantee a where clause is present before validating clause structure against the schema.

Source

Thrown at entities/filters/filters_validator.go:35

	"github.com/pkg/errors"
	entcfg "github.com/weaviate/weaviate/entities/config"
	"github.com/weaviate/weaviate/entities/filters/nested"
	"github.com/weaviate/weaviate/entities/models"
	"github.com/weaviate/weaviate/entities/schema"
)

// string and stringArray are deprecated as of v1.19
// however they are allowed in filters and considered aliases
// for text and textArray
var deprecatedDataTypeAliases map[schema.DataType]schema.DataType = map[schema.DataType]schema.DataType{
	schema.DataTypeString:      schema.DataTypeText,
	schema.DataTypeStringArray: schema.DataTypeTextArray,
}

func ValidateFilters(authorizedGetClass func(string) (*models.Class, error), filters *LocalFilter) error {
	if filters == nil {
		return errors.New("empty where")
	}
	cw := newClauseWrapper(filters.Root)
	if err := validateClause(authorizedGetClass, cw); err != nil {
		return err
	}
	cw.updateClause()
	return nil
}

func validateClause(authorizedGetClass func(string) (*models.Class, error), cw *clauseWrapper) error {
	// check if nested
	if cw.getOperands() != nil {
		var errs []error

		for i, child := range cw.getOperands() {
			if err := validateClause(authorizedGetClass, child); err != nil {
				errs = append(errs, errors.Wrapf(err, "child operand at position %d", i))
			}

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Provide a non-nil where filter before invoking the operation.
  2. Check the request actually contained a where clause; reject it earlier at the handler with a 422-style message.
  3. If 'no filter' is legitimate, skip ValidateFilters instead of passing nil.

Example fix

// before
if err := filters.ValidateFilters(auth, whereFilter); err != nil { ... }
// after
if whereFilter == nil {
  return errors.New("a where filter is required")
}
if err := filters.ValidateFilters(auth, whereFilter); err != nil { ... }
Defensive patterns

Strategy: validation

Validate before calling

if whereFilter == nil {
  return errors.New("a where filter is required")
}

Try / catch

if err := filters.ValidateFilters(auth, f); err != nil {
  if err.Error() == "empty where" {
    return errors.New("request must include a where filter")
  }
  return err
}

Prevention

When it happens

Trigger: Calling ValidateFilters(nil) directly, or an internal code path (Search/Aggregate/parseWhere/validateBatchDelete) that constructs a LocalFilter as nil when a where filter was expected.

Common situations: Library consumers programmatically building batch delete or aggregate requests without checking that a where filter was actually parsed from the request body.

Related errors


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