dgraph-io/dgraph · error
facets are not supported in the rdf output format
Error message
facets are not supported in the rdf output format
What it means
RDF serialization does not support facet extraction unless facets are fully expanded. validateSubGraphForRDF rejects a sub-graph that requests specific facets (sg.Params.Facet set) without ExpandAll, since named facet projection cannot be expressed in RDF output.
Source
Thrown at query/outputrdf.go:232
func validateSubGraphForRDF(sg *SubGraph) error {
if sg.IsGroupBy() {
return errors.New("groupby is not supported in rdf output format")
}
uidCount := sg.Attr == "uid" && sg.Params.DoCount && sg.IsInternal()
if uidCount {
return errors.New("uid count is not supported in the rdf output format")
}
if sg.Params.Normalize {
return errors.New("normalize directive is not supported in the rdf output format")
}
if sg.Params.IgnoreReflex {
return errors.New("ignorereflex directive is not supported in the rdf output format")
}
if sg.SrcFunc != nil && sg.SrcFunc.Name == "checkpwd" {
return errors.New("chkpwd function is not supported in the rdf output format")
}
if sg.Params.Facet != nil && !sg.Params.ExpandAll {
return errors.New("facets are not supported in the rdf output format")
}
return nil
}
func quotedNumber(val []byte) []byte {
const overhead = 2 // opening and closing quotes
if len(val) > math.MaxInt-overhead {
// Extremely unlikely, but handle overflow case
tmpVal := make([]byte, 0)
tmpVal = append(tmpVal, '"')
tmpVal = append(tmpVal, val...)
tmpVal = append(tmpVal, '"')
return tmpVal
}
tmpVal := make([]byte, 0, overhead+len(val))
tmpVal = append(tmpVal, '"')
tmpVal = append(tmpVal, val...)
tmpVal = append(tmpVal, '"')View on GitHub (pinned to 759e242be6)
Solutions
- Use @facets with expand-all syntax so facets serialize as facet triples in RDF
- Switch to JSON output for selective facet projection
- Drop the facet projection if edge metadata is not needed in the export
Example fix
// before (rdf output)
{ me(func: uid(0x1)) { friend @facets(since) } }
// after
{ me(func: uid(0x1)) { friend @facets } } // expand-all form, or use JSON output for @facets(since) Defensive patterns
Strategy: validation
Validate before calling
// Go: check facet projection form before RDF output
if strings.Contains(query, "@facets(") && !strings.Contains(query, "@facets(*)") {
return errors.New("named facet projection needs JSON output; use @facets for RDF")
} Type guard
func usesNamedFacets(dql string) bool {
return strings.Contains(dql, "@facets(")
} Try / catch
res, err := txn.QueryRDF(ctx, dql)
if err != nil && strings.Contains(err.Error(), "facets are not supported in the rdf") {
return txn.Query(ctx, dql) // JSON handles named facets
} Prevention
- Use expand-all @facets for RDF exports
- Restrict named facet projection to JSON queries
- Convert facet triples client-side if selective output is required
When it happens
Trigger: A query projecting specific facets (e.g. `friend @facets(since)`) with RDF output format; facets are only accepted when `@facets(*)` / ExpandAll is used.
Common situations: Exporting edge metadata (weights, timestamps, provenance) as RDF; queries ported from JSON where named facets worked.
Related errors
- unexpected end of facets
- expected '(' but found %v at facet
- expected key but found %v
- empty facetKeys not allowed
- groupby is not supported in rdf output format
AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01).
Data as JSON: /api/errors/a7a78394387a9ce1.
Report an issue: GitHub.