{"record":{"id":"5ef7c29df28a4aa0","repo":"dgraph-io/dgraph","slug":"updateextsnapshotstreamingstaterequest-must-not-be-5ef7c2","errorCode":null,"errorMessage":"UpdateExtSnapshotStreamingStateRequest must not be nil","messagePattern":"UpdateExtSnapshotStreamingStateRequest must not be nil","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"worker/import.go","lineNumber":459,"sourceCode":"\n\t\t// Normal data chunk: send -> wait ack -> send upstream ack.\n\t\tif err := out.Send(&api.StreamExtSnapshotRequest{Pkt: req.Pkt}); err != nil {\n\t\t\treturn fmt.Errorf(\"send data downstream(%d): %w\", groupId, err)\n\t\t}\n\t\tif _, err := out.Recv(); err != nil {\n\t\t\treturn fmt.Errorf(\"ack data downstream(%d): %w\", groupId, err)\n\t\t}\n\t\tif err := in.Send(&api.StreamExtSnapshotResponse{}); err != nil {\n\t\t\treturn fmt.Errorf(\"send ack upstream: %w\", err)\n\t\t}\n\n\t}\n}\n\nfunc (w *grpcWorker) UpdateExtSnapshotStreamingState(ctx context.Context,\n\treq *api.UpdateExtSnapshotStreamingStateRequest) (*pb.Status, error) {\n\tif req == nil {\n\t\treturn nil, errors.New(\"UpdateExtSnapshotStreamingStateRequest must not be nil\")\n\t}\n\n\tif req.Start && req.Finish {\n\t\treturn nil, errors.New(\"UpdateExtSnapshotStreamingStateRequest cannot have both Start and Finish set to true\")\n\t}\n\n\tglog.Infof(\"[import] Applying import mode proposal: %+v\", req)\n\terr := groups().Node.proposeAndWait(ctx, &pb.Proposal{ExtSnapshotState: req})\n\n\treturn &pb.Status{}, err\n}\n\n// StreamExtSnapshot handles the stream of key-value pairs sent from proxy alpha.\n// It receives a Forward flag from the stream to determine if the current node is the leader.\n// If the node is the leader (Forward is true), it streams the data to its followers.\n// Otherwise, it simply writes the data to BadgerDB and flushes it.\nfunc (w *grpcWorker) StreamExtSnapshot(stream pb.Worker_StreamExtSnapshotServer) error {\n\tglog.Info(\"[import] trying to update the import mode to false\")","sourceCodeStart":441,"sourceCodeEnd":477,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/worker/import.go#L441-L477","documentation":"UpdateExtSnapshotStreamingState validates its request before proposing it to the Raft group. A nil *api.UpdateExtSnapshotStreamingStateRequest is rejected outright with this error because there is no state change to apply.","triggerScenarios":"Calling the gRPC Worker.UpdateExtSnapshotStreamingState API (directly or via a client) with a nil request message, e.g. constructing the call programmatically without instantiating the request struct.","commonSituations":"Hand-written gRPC client code passing nil; a wrapper/SDK forwarding an unset message; tests invoking the worker method directly with nil.","solutions":["Always pass a non-nil &api.UpdateExtSnapshotStreamingStateRequest{} with Start or Finish set.","Check the caller that builds the request and initialize it.","If using a generic client wrapper, ensure it does not drop an empty-but-intended message."],"exampleFix":"// before\nresp, err := wc.UpdateExtSnapshotStreamingState(ctx, nil)\n// after\nreq := &api.UpdateExtSnapshotStreamingStateRequest{Start: true}\nresp, err := wc.UpdateExtSnapshotStreamingState(ctx, req)","handlingStrategy":"validation","validationCode":"if req == nil {\n    return errors.New(\"UpdateExtSnapshotStreamingStateRequest must be initialized before calling\")\n}","typeGuard":"func validStateReq(req *api.UpdateExtSnapshotStreamingStateRequest) bool {\n    return req != nil\n}","tryCatchPattern":"if _, err := wc.UpdateExtSnapshotStreamingState(ctx, req); err != nil {\n    if strings.Contains(err.Error(), \"must not be nil\") { /* fix caller: build request */ }\n}","preventionTips":["Always construct the request struct explicitly before the RPC","Never pass nil protobuf messages to worker RPCs","Add client-side nil checks in wrapper/SDK functions"],"tags":["validation","grpc","nil-check"],"backgroundTag":"nil-request-validation","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}