{"record":{"id":"685e27a9fda5a3a0","repo":"dgraph-io/dgraph","slug":"tablet-predicate-is-empty-in-v","errorCode":null,"errorMessage":"Tablet predicate is empty in %+v","messagePattern":"Tablet predicate is empty in %\\+v","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"dgraph/cmd/zero/zero.go","lineNumber":690,"sourceCode":"\t\tMember: m,\n\t}\n\treturn resp, nil\n}\n\n// DeleteNamespace removes the tablets for deleted namespace from the membership state.\nfunc (s *Server) DeleteNamespace(ctx context.Context, in *pb.DeleteNsRequest) (*pb.Status, error) {\n\terr := s.Node.proposeAndWait(ctx, &pb.ZeroProposal{DeleteNs: in})\n\treturn &pb.Status{}, err\n}\n\n// ShouldServe returns the tablet serving the predicate passed in the request.\nfunc (s *Server) ShouldServe(\n\tctx context.Context, tablet *pb.Tablet) (resp *pb.Tablet, err error) {\n\tctx, span := otel.Tracer(\"\").Start(ctx, \"Zero.ShouldServe\")\n\tdefer span.End()\n\n\tif tablet.Predicate == \"\" {\n\t\treturn resp, errors.Errorf(\"Tablet predicate is empty in %+v\", tablet)\n\t}\n\tif tablet.GroupId == 0 && !tablet.ReadOnly {\n\t\treturn resp, errors.Errorf(\"Group ID is Zero in %+v\", tablet)\n\t}\n\n\t// Check who is serving this tablet.\n\ttab := s.ServingTablet(tablet.Predicate)\n\tspan.SetAttributes(attribute.String(\"tablet_predicate\", tablet.Predicate))\n\tif tab != nil && !tablet.Force {\n\t\t// Someone is serving this tablet. Could be the caller as well.\n\t\t// The caller should compare the returned group against the group it holds to check who's\n\t\t// serving.\n\t\treturn tab, nil\n\t}\n\n\t// Read-only requests should return an empty tablet instead of asking zero\n\t// to serve the predicate.\n\tif tablet.ReadOnly {","sourceCodeStart":672,"sourceCodeEnd":708,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/dgraph/cmd/zero/zero.go#L672-L708","documentation":"Zero's ShouldServe RPC validates an incoming Tablet request and requires a non-empty Predicate (the key/edge being served). An empty predicate means the request is malformed — Zero cannot look up or assign ownership without it — so it errors immediately before any tablet lookup.","triggerScenarios":"Calling ShouldServe (used by alphas during tablet/oracle checks) with pb.Tablet{Predicate: \"\"}; buggy or misconfigured internal callers sending uninitialized Tablet structs.","commonSituations":"Version-skew between alpha and Zero where a field was dropped; hand-rolled clients/tests constructing Tablet messages incorrectly; corrupted internal state producing empty predicate strings.","solutions":["Fix the caller so the Tablet message includes the predicate (the edge/UID key) before invoking ShouldServe.","Upgrade alpha and Zero to matching versions to eliminate protocol skew.","Check client code that constructs pb.Tablet for default/zero-value strings.","If it recurs unexpectedly, capture the gRPC request (the error prints the Tablet via %+v) and inspect the calling component."],"exampleFix":"// before\ntablet, err := zero.ShouldServe(ctx, &pb.Tablet{GroupId: 1})\n\n// after\ntablet, err := zero.ShouldServe(ctx, &pb.Tablet{GroupId: 1, Predicate: \"http://ex.com/friend\"})","handlingStrategy":"validation","validationCode":"if tablet.Predicate == \"\" {\n    return fmt.Errorf(\"cannot call ShouldServe with an empty predicate\")\n}","typeGuard":null,"tryCatchPattern":"resp, err := zero.ShouldServe(ctx, tablet)\nif err != nil && strings.Contains(err.Error(), \"predicate is empty\") {\n    return fmt.Errorf(\"caller built an invalid Tablet message: %w\", err)\n}","preventionTips":["Validate pb.Tablet fields (non-empty Predicate) before every ShouldServe call.","Keep alpha and Zero on compatible versions to avoid dropped fields.","Add unit tests covering Tablet message construction."],"tags":["dgraph-zero","validation","grpc","tablet"],"backgroundTag":"missing-required-argument","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}