dgraph-io/dgraph · error

ignorereflex directive is not supported in the rdf output fo

Error message

ignorereflex directive is not supported in the rdf output format

What it means

The ignorereflex directive suppresses reflexive (self-referencing) edges, but RDF output has no mechanism to honor it. validateSubGraphForRDF rejects sub-graphs with sg.Params.IgnoreReflex set during RDF serialization.

Source

Thrown at query/outputrdf.go:226

	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)
		tmpVal = append(tmpVal, '"')
		tmpVal = append(tmpVal, val...)
		tmpVal = append(tmpVal, '"')

View on GitHub (pinned to 759e242be6)

Solutions

  1. Remove @ignorereflex and filter reflexive edges client-side
  2. Use JSON output format where ignorereflex is supported
  3. Post-process the RDF to drop triples where subject == object

Example fix

// before
{ me(func: uid(0x1)) @recurse(follow, ignorereflex) { follow } }
// after (rdf): { me(func: uid(0x1)) @recurse(depth: 3) { follow } } // filter self-loops after export
Defensive patterns

Strategy: validation

Validate before calling

// Go: reject @ignorereflex for RDF output
if strings.Contains(query, "@ignorereflex") {
    return errors.New("ignorereflex requires JSON output")
}

Type guard

func usesIgnoreReflex(dql string) bool {
    return strings.Contains(dql, "@ignorereflex")
}

Try / catch

res, err := txn.QueryRDF(ctx, dql)
if err != nil && strings.Contains(err.Error(), "ignorereflex directive is not supported") {
    return txn.Query(ctx, strings.ReplaceAll(dql, "@ignorereflex", ""))
}

Prevention

When it happens

Trigger: A query with `@ignorereflex` on a recursion or edge traversal (e.g. `recurse(follow) @ignorereflex`) executed with RDF output format.

Common situations: Graph traversal exports of cyclic graphs (follows/likes edges) requested in RDF; combined directives copied from JSON queries.

Related errors


AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01). Data as JSON: /api/errors/4f705d1842c00d9e. Report an issue: GitHub.