dgraph-io/dgraph · error
normalize directive is not supported in the rdf output forma
Error message
normalize directive is not supported in the rdf output format
What it means
The normalize directive flattens nested results into a single array, which only exists in JSON output. validateSubGraphForRDF rejects any sub-graph with sg.Params.Normalize set when serializing to RDF.
Source
Thrown at query/outputrdf.go:223
return buf
}
buf := make([]byte, 0, overhead+len(val))
buf = append(buf, '<')
buf = append(buf, val...)
buf = append(buf, '>')
return buf
}
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)View on GitHub (pinned to 759e242be6)
Solutions
- Remove the @normalize directive
- Switch to JSON output format
- Do the flattening/reshaping client-side after receiving RDF
Example fix
// before
{ me(func: eq(name, "Alice")) @normalize { friend { name } } }
// after
{ me(func: eq(name, "Alice")) { friend { name } } } Defensive patterns
Strategy: validation
Validate before calling
// Go: strip or reject @normalize when RDF output requested
if strings.Contains(query, "@normalize") {
query = strings.ReplaceAll(query, " @normalize", "")
} Type guard
func usesNormalize(dql string) bool {
return strings.Contains(dql, "@normalize")
} Try / catch
res, err := txn.QueryRDF(ctx, dql)
if err != nil && strings.Contains(err.Error(), "normalize directive is not supported") {
return txn.Query(ctx, strings.ReplaceAll(dql, "@normalize", ""))
} Prevention
- Only add @normalize to JSON-output queries
- Keep a single query-builder that knows the target output format
- Flatten results client-side for RDF exports
When it happens
Trigger: Adding `@normalize` to a query (e.g. `query q($x: string) { me(func: eq(name, $x)) @normalize { name friend { name } } }`) while requesting RDF output.
Common situations: Templates that append @normalize for JSON shape control but keep a fixed RDF output header.
Related errors
- groupby is not supported in rdf output format
- uid count is not supported in the rdf output format
- ignorereflex directive is not supported in the rdf output fo
- chkpwd function is not supported in the rdf output format
- facets are not supported in the rdf output format
AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01).
Data as JSON: /api/errors/3122474507f1337f.
Report an issue: GitHub.