dgraph-io/dgraph · error
Unhandled pb.node <%v> with parent <%v>
Error message
Unhandled pb.node <%v> with parent <%v>
What it means
When building pb.node messages for a subgraph during result construction, Dgraph handles only known cases: value-variable nodes, uid with count, and a few others. Any subgraph whose attribute and parameters do not match a supported case falls into the default branch and produces this internal error, naming the node attr and its parent's attr.
Source
Thrown at query/query.go:1373
it := doneVars[sg.Params.Var]
it.Vals = mp
doneVars[sg.Params.Var] = it
sg.Params.UidToVal = mp
default:
glog.V(3).Info("Warning: Math expression is using unassigned values or constants")
}
// Put it in this node.
case len(sg.Params.NeedsVar) > 0:
// This is a var() block.
srcVar := sg.Params.NeedsVar[0]
srcMap := doneVars[srcVar.Name]
// The value var can be empty. No need to check for nil.
sg.Params.UidToVal = srcMap.Vals
case sg.Attr == "uid" && sg.Params.DoCount:
// This is the count(uid) case.
// We will do the computation later while constructing the result.
default:
return errors.Errorf("Unhandled pb.node <%v> with parent <%v>", sg.Attr, parent.Attr)
}
return nil
}
func (sg *SubGraph) populatePostAggregation(doneVars map[string]varValue, path []*SubGraph,
parent *SubGraph) error {
for idx := range sg.Children {
child := sg.Children[idx]
path = append(path, sg)
err := child.populatePostAggregation(doneVars, path, sg)
path = path[:len(path)-1]
if err != nil {
return err
}
}
return sg.valueVarAggregation(doneVars, path, parent)View on GitHub (pinned to 759e242be6)
Solutions
- Simplify the query to isolate which clause triggers the unhandled node case
- Remove the value-variable/count combination on the offending predicate and split into two queries
- Upgrade Dgraph — this is often an internal bug fixed in later releases
- File an issue with the minimal reproducing query if it persists
Example fix
// before: unsupported mix on one edge
me(func: uid(1)) { friend { c as count(uid) } x as sum(val(c)) }
// after: split concerns
me(func: uid(1)) { friend { c as count(uid) } }
y(func: uid(1)) { f as friend { friend { uid } } } Defensive patterns
Strategy: try-catch
Try / catch
if err != nil && strings.Contains(err.Error(), "Unhandled pb.node") {
// internal case: isolate the offending clause and simplify the query
return fmt.Errorf("unsupported query shape: %w", err)
} Prevention
- Avoid exotic combinations of value variables and count(uid) on the same edge
- Pin a known-good Dgraph server version and upgrade deliberately
- Reproduce complex queries in Ratel before shipping
- Report minimal reproducers to Dgraph if this internal error appears
When it happens
Trigger: A query shape reaches fillForVal/pb.node construction with an Attr/parameter combination that is neither a value-var source nor 'uid' with DoCount — typically an unsupported aggregation/variable combination or an internal bug triggered by unusual query syntax.
Common situations: Exotic queries mixing value variables and count(uid) on the same edge; server bugs on edge-case queries; version mismatch between client query syntax and server support.
Related errors
- error while writing string
- error while building unique query
- Wrong type %v encountered for func ln
- Wrong type %v encountered for func exp
- Wrong type %v encountered for func u-
AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01).
Data as JSON: /api/errors/81c14a8a85be32c8.
Report an issue: GitHub.