{"record":{"id":"605445848d8b90f7","repo":"dgraph-io/dgraph","slug":"unique-validation-failed-to-fetch-schema-for-predi","errorCode":null,"errorMessage":"unique validation failed to fetch schema for predicates %v","messagePattern":"unique validation failed to fetch schema for predicates (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"edgraph/server.go","lineNumber":1906,"sourceCode":"\t\t\t}\n\t\t\tfullPred := x.NamespaceAttr(currNs, pred.Predicate)\n\t\t\tif _, ok := schema.State().Get(ctx, fullPred); !ok {\n\t\t\t\tmissingPreds[fullPred] = struct{}{}\n\t\t\t}\n\t\t}\n\t}\n\n\trepaired := make(map[string]bool)\n\tif len(missingPreds) > 0 {\n\t\tpredList := make([]string, 0, len(missingPreds))\n\t\tfor p := range missingPreds {\n\t\t\tpredList = append(predList, p)\n\t\t}\n\n\t\tschReq := &pb.SchemaRequest{Predicates: predList}\n\t\tremoteNodes, err := worker.GetSchemaOverNetwork(ctx, schReq)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"unique validation failed to fetch schema for predicates %v\", predList)\n\t\t}\n\n\t\tfor _, node := range remoteNodes {\n\t\t\trepaired[node.Predicate] = node.Unique\n\t\t}\n\t}\n\n\tqc.uniqueVars = map[uint64]uniquePredMeta{}\n\tfor gmuIndex, gmu := range qc.gmuList {\n\t\tvar buildQuery strings.Builder\n\t\tfor rdfIndex, pred := range gmu.Set {\n\t\t\tif isGalaxyQuery {\n\t\t\t\t// The caller should make sure that the directed edges contain the namespace we want\n\t\t\t\t// to insert into.\n\t\t\t\tnamespace = pred.Namespace\n\t\t\t}\n\t\t\tif pred.Predicate != \"dgraph.xid\" {\n\t\t\t\t// [TODO] Don't check if it's dgraph.xid. It's a bug as this node might not be aware","sourceCodeStart":1888,"sourceCodeEnd":1924,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/edgraph/server.go#L1888-L1924","documentation":"Before building unique-check queries, addQueryIfUnique must know whether each mutated predicate is unique. If the predicate's schema is not cached locally, Dgraph fetches it over the network from other Alpha nodes via GetSchemaOverNetwork; a transport/consensus failure there is wrapped with this message (edgraph/server.go:1906). The mutation itself is aborted because uniqueness cannot be verified. The underlying cause is carried in the wrapped error.","triggerScenarios":"A mutation on a predicate not present in the local schema cache while the cluster cannot serve the schema request — leader unreachable, Raft quorum lost, network partition between Alphas, or the request hitting an Alpha that cannot reach the Zero/Alpha holding the schema during the mutation path (edgraph/server.go:1906).","commonSituations":"Rolling restarts or node down in the cluster; new Alpha joining before it syncs schema; network misconfiguration (firewall, TLS mismatch) between Alphas; cluster degraded after Zero leader election; sending mutations to a stale/rejoined node.","solutions":["Read the wrapped cause: if it is connection refused/timeouts, check cluster health (curl /health, alpha endpoints, Zero raft state) and restore connectivity","Retry the mutation once the cluster is healthy — this is typically transient","Ensure all Alphas are on the same version and joined to the same Zero group so schema propagation works","Check TLS/mutual-auth settings between nodes; mismatched certs cause schema-over-network fetch failures","Avoid mutations during rolling restarts; wait for all Alphas to report healthy"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := mutate(ctx, mu)\nif err != nil && strings.Contains(err.Error(), \"unique validation failed to fetch schema\") {\n\t// transient cluster issue: retry with backoff\n\ttime.Sleep(backoff)\n\treturn mutate(ctx, mu)\n}","preventionTips":["Monitor cluster health (/health, Zero raft state) before bulk mutations","Keep all Alphas the same version and fully joined to Zero","Avoid mutations during rolling restarts or leader elections","Verify inter-node connectivity and TLS configuration"],"tags":["dgraph","network","schema","cluster"],"backgroundTag":"schema-fetch-over-network-failed","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}