dgraph-io/dgraph · error
Unsupported operation in facet filtering: %s.
Error message
Unsupported operation in facet filtering: %s.
What it means
Error returned by the query processing worker (worker/task.go) when a facet filter uses an operation that is not supported for facet filtering. The unsupported operation name is reported via %s. Fix by using a supported facet filter operator.
Source
Thrown at worker/task.go:2494
ftree.children = append(ftree.children, ftreec)
}
numChild := len(tree.Children)
switch ftree.op {
case "not":
if numChild != 1 {
return nil, errors.Errorf("Expected 1 child for not but got %d.", numChild)
}
case "and":
if numChild != 2 {
return nil, errors.Errorf("Expected 2 child for not but got %d.", numChild)
}
case "or":
if numChild != 2 {
return nil, errors.Errorf("Expected 2 child for not but got %d.", numChild)
}
default:
return nil, errors.Errorf("Unsupported operation in facet filtering: %s.", tree.Op)
}
return ftree, nil
}
type countParams struct {
readTs uint64
counts []int64
attr string
gid uint32
reverse bool // If query is asking for ~pred
fn string // function name
}
func (qs *queryState) evaluate(cp countParams, out *pb.Result) error {
countl := cp.counts[0]
var counth int64
if cp.fn == between {
counth = cp.counts[1]View on GitHub (pinned to 759e242be6)
Solutions
- Rewrite the facet filter using only not/and/or plus supported facet comparison functions.
- If using a client library to build queries, verify it supports facets correctly for your Dgraph version.
- Simplify the query to isolate which construct produces the unsupported operator.
Example fix
// before
friend @facets(has(score))
// after
friend filter has(friend) { @facets(gt(score, 3)) } Defensive patterns
Strategy: validation
Validate before calling
const allowedOps = new Set(["not","and","or"]);
function validateFacetOps(tree) {
if (!allowedOps.has(tree.op)) throw new Error(`Unsupported facet op: ${tree.op}`);
(tree.children || []).forEach(validateFacetOps);
} Try / catch
try {
return await txn.query(query);
} catch (e) {
if (/Unsupported operation in facet filtering/.test(String(e))) {
// strip/relocate the unsupported construct and retry
}
throw e;
} Prevention
- Use only not/and/or operators in facet filters.
- Validate client-library query ASTs before sending.
- Isolate new query constructs in tests before combining with @facets.
When it happens
Trigger: An internal filter tree node whose Op is neither not, and, nor or reaches the facet preprocessing — typically from a query construct unsupported in @facets or from programming errors building query trees programmatically.
Common situations: Using math/has/uid functions in facet position; client libraries emitting custom operator names; corrupted or hand-constructed query ASTs.
Related errors
- Cannot specify order at both args and facets
- One argument expected in %s, but got %d.
- Fn %s not supported in preprocessFilter.
- Expected 1 child for not but got %d.
- Expected 2 child for not but got %d.
AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01).
Data as JSON: /api/errors/053b5f265612b62c.
Report an issue: GitHub.