dgraph-io/dgraph · error

cannot retrieve predicate information

Error message

cannot retrieve predicate information

What it means

After collecting all predicate names referenced by the type updates, verifyTypes fetches their current schema via GetSchemaOverNetwork. If that network call fails, the error is wrapped as 'cannot retrieve predicate information'. This is a wrapper around the underlying schema-fetch failure (network partition, Zero/Alpha unavailability, timeouts, or gRPC errors), so the root cause is in the wrapped error (err) included by Wrapf.

Source

Thrown at worker/mutation.go:788

		}

		for _, field := range t.Fields {
			fieldName := field.Predicate
			ns, attr := x.ParseNamespaceAttr(fieldName)
			if attr[0] == '~' {
				fieldName = x.NamespaceAttr(ns, attr[1:])
			}

			if _, ok := reqPredSet[fieldName]; !ok {
				fields = append(fields, fieldName)
			}
		}
	}

	// Retrieve the schema for those predicates.
	schemas, err := GetSchemaOverNetwork(ctx, &pb.SchemaRequest{Predicates: fields})
	if err != nil {
		return errors.Wrapf(err, "cannot retrieve predicate information")
	}
	schemaSet := make(map[string]struct{})
	for _, schemaNode := range schemas {
		schemaSet[schemaNode.Predicate] = struct{}{}
	}

	for _, t := range m.Types {
		// Verify all the fields in the type are already on the schema or come included in
		// this request.
		for _, field := range t.Fields {
			fieldName := field.Predicate
			ns, attr := x.ParseNamespaceAttr(fieldName)
			if attr[0] == '~' {
				fieldName = x.NamespaceAttr(ns, attr[1:])
			}

			_, inSchema := schemaSet[fieldName]
			_, inRequest := reqPredSet[fieldName]

View on GitHub (pinned to 759e242be6)

Solutions

  1. Inspect the wrapped cause in the error log (it follows 'cannot retrieve predicate information: ...') and fix that root issue (connectivity, Zero health, timeout)
  2. Check cluster health: dgraph zero and alpha logs, /health endpoints, and that all alphas can reach Zero's internal port (5080)
  3. Retry the mutation once the cluster is healthy — schema fetch failures are often transient
  4. If timeouts are the cause, increase the client context deadline for the mutation request

Example fix

// before
schemas, err := GetSchemaOverNetwork(ctx, req) // fails: zero unreachable

// after (operator-side: ensure zero is reachable and healthy)
# curl http://zero:6080/health
# dgraph zero --my=zero:5080 --replicas 3
# then retry the mutation
Defensive patterns

Strategy: retry

Validate before calling

// Pre-check cluster reachability before large schema+mutation deployments
for _, addr := range []string{"zero:6080", "alpha:8080"} {
	resp, err := http.Get(fmt.Sprintf("http://%s/health", addr))
	if err != nil || resp.StatusCode != 200 {
		log.Fatalf("node %s unhealthy: %v", addr, err)
	}
}

Try / catch

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
_, err := txn.Mutate(ctx, mu)
if err != nil && strings.Contains(err.Error(), "cannot retrieve predicate information") {
	// transient: retry with backoff after checking Zero/Alpha health
	err = retry.Do(func() error { _, err := txn.Mutate(ctx, mu); return err })
}

Prevention

When it happens

Trigger: verifyTypes is invoked from MutateOverNetwork with type updates; GetSchemaOverNetwork(ctx, &pb.SchemaRequest{Predicates: fields}) fails due to unreachable Zero, dropped gRPC connection, context deadline exceeded, or the node not being a leader / unable to serve the schema request.

Common situations: Zero or Alpha nodes down or restarting during a schema+mutation deployment; network partition between Alphas and Zero; firewall/security-group changes blocking the internal gRPC port; transient timeouts under load; misconfigured dgraph zero/alpha addresses.

Related errors


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