{"record":{"id":"357472ace411b94b","repo":"dgraph-io/dgraph","slug":"predicate-not-specified","errorCode":null,"errorMessage":"Predicate not specified","messagePattern":"Predicate not specified","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"worker/predicate_move.go","lineNumber":35,"sourceCode":"\t\"github.com/golang/glog\"\n\t\"github.com/pkg/errors\"\n\t\"go.opentelemetry.io/otel/attribute\"\n\t\"go.opentelemetry.io/otel/trace\"\n\t\"google.golang.org/protobuf/proto\"\n\n\t\"github.com/dgraph-io/badger/v4\"\n\tbpb \"github.com/dgraph-io/badger/v4/pb\"\n\t\"github.com/dgraph-io/dgo/v250/protos/api\"\n\t\"github.com/dgraph-io/dgraph/v25/posting\"\n\t\"github.com/dgraph-io/dgraph/v25/protos/pb\"\n\t\"github.com/dgraph-io/dgraph/v25/schema\"\n\t\"github.com/dgraph-io/dgraph/v25/tok/hnsw\"\n\t\"github.com/dgraph-io/dgraph/v25/x\"\n\t\"github.com/dgraph-io/ristretto/v2/z\"\n)\n\nvar (\n\terrEmptyPredicate = errors.Errorf(\"Predicate not specified\")\n\terrNotLeader      = errors.Errorf(\"Server is not leader of this group\")\n\temptyPayload      = api.Payload{}\n)\n\n// size of kvs won't be too big, we would take care before proposing.\nfunc populateKeyValues(ctx context.Context, kvs []*bpb.KV) error {\n\tglog.Infof(\"Writing %d keys\\n\", len(kvs))\n\tif len(kvs) == 0 {\n\t\treturn nil\n\t}\n\twriter := posting.NewTxnWriter(pstore)\n\tif err := writer.Write(&bpb.KVList{Kv: kvs}); err != nil {\n\t\treturn err\n\t}\n\tif err := writer.Flush(); err != nil {\n\t\treturn err\n\t}\n\tpk, err := x.Parse(kvs[0].Key)","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/worker/predicate_move.go#L17-L53","documentation":"errEmptyPredicate is returned by MovePredicate in the dgraph worker package when a move-tablet request carries an empty predicate name. Dgraph refuses to start a predicate move without an explicit predicate, since it must know which tablet/keyspace to stream between groups.","triggerScenarios":"Calling MovePredicate via the internal MoveTablet RPC (triggered by Zero rebalancing or `movePredicates`) with pred == \"\" — e.g. a malformed Zero move request or a state.json/tablet entry with a blank predicate.","commonSituations":"Corrupt Zero internal state proposing an empty tablet move; bugs or manual edits in Zero's tablet map; custom tooling invoking the internal move API with unset fields.","solutions":["Identify the Zero request that carried the empty predicate from logs and check why tablet state has a blank pred.","Restart Zero to rebuild consistent internal tablet state.","If from custom tooling, ensure the MoveTablet/MovePredicate request always sets the Pred field before calling.","Upgrade to a fixed Dgraph release if this arises during normal Zero rebalancing."],"exampleFix":"// before\nreq := &pb.MoveTabletRequest{SourceGroupId: 1, DestGroupId: 2}\n// after\nreq := &pb.MoveTabletRequest{SourceGroupId: 1, DestGroupId: 2, Tablet: &pb.Tablet{Predicate: \"friend\"}}","handlingStrategy":"validation","validationCode":"func validateMove(req *pb.MoveTabletRequest) error {\n\tif req == nil || req.Tablet == nil || req.Tablet.Predicate == \"\" {\n\t\treturn errors.New(\"predicate must be set before MoveTablet\")\n\t}\n\treturn nil\n}","typeGuard":"func hasPredicate(t *pb.Tablet) bool {\n\treturn t != nil && t.Predicate != \"\"\n}","tryCatchPattern":"if err := worker.MovePredicate(ctx, pred, src, dst); err != nil {\n\tif strings.Contains(err.Error(), \"Predicate not specified\") {\n\t\t// reject the request upstream / fix Zero tablet state\n\t}\n}","preventionTips":["Never hand-edit Zero's tablet state or state.json","Validate internal move requests set Pred before dispatching","Keep Zero and Alpha versions in sync","Monitor for empty-predicate tablets via `dgraph debug`"],"tags":["dgraph","predicate-move","validation","zero"],"backgroundTag":"missing-predicate","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}