{"record":{"id":"39e687e1d792e9ce","repo":"dgraph-io/dgraph","slug":"stream-orchestration-failed-for-group-v-w-ba","errorCode":null,"errorMessage":"stream orchestration failed for group [%v]: %w, badger path: %s","messagePattern":"stream orchestration failed for group \\[(.+?)\\]: %w, badger path: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"dgraph/cmd/dgraphimport/import_client.go","lineNumber":234,"sourceCode":"\tstream := ps.NewStreamAt(math.MaxUint64)\n\tstream.LogPrefix = \"[import] Sending external snapshot to group [\" + fmt.Sprintf(\"%d\", groupId) + \"]\"\n\tstream.KeyToList = nil\n\tstream.Send = func(buf *z.Buffer) error {\n\t\tp := &api.StreamPacket{Data: buf.Bytes()}\n\t\tif err := out.Send(&api.StreamExtSnapshotRequest{Pkt: p}); err != nil && !errors.Is(err, io.EOF) {\n\t\t\treturn fmt.Errorf(\"failed to send data chunk: %w\", err)\n\t\t}\n\t\tif _, err := out.Recv(); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to receive response for group ID [%v] from the server: %w\", groupId, err)\n\t\t}\n\t\tglog.Infof(\"[import] Group [%v]: Received ACK for sending data chunk\", groupId)\n\n\t\treturn nil\n\t}\n\n\t// Execute the stream process\n\tif err := stream.Orchestrate(ctx); err != nil {\n\t\treturn fmt.Errorf(\"stream orchestration failed for group [%v]: %w, badger path: %s\", groupId, err, ps.Opts().Dir)\n\t}\n\n\t// Send the final 'done' signal to mark completion\n\tglog.Infof(\"[import] Sending completion signal for group [%d]\", groupId)\n\tdone := &api.StreamPacket{Done: true}\n\n\tif err := out.Send(&api.StreamExtSnapshotRequest{Pkt: done}); err != nil && !errors.Is(err, io.EOF) {\n\t\treturn fmt.Errorf(\"failed to send 'done' signal for group [%d]: %w\", groupId, err)\n\t}\n\n\tfor {\n\t\tif ctx.Err() != nil {\n\t\t\treturn ctx.Err()\n\t\t}\n\t\tresp, err := out.Recv()\n\t\tif errors.Is(err, io.EOF) {\n\t\t\treturn fmt.Errorf(\"server closed stream before Finish=true for group [%d]\", groupId)\n\t\t}","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/dgraph/cmd/dgraphimport/import_client.go#L216-L252","documentation":"Returned by streamBadger when badger's Stream.Orchestrate(ctx) fails while iterating the pdir and pushing packets through the Send callback. The message includes the badger directory path to help locate the offending pdir. Orchestrate aggregates errors from stream.Send (chunk send/recv) or internal badger iteration failures.","triggerScenarios":"Badger iteration error while reading the pdir (corrupted file, IO error); the Send callback returned an error (chunk send/recv failures, errors 86/87); ctx cancelled mid-orchestration.","commonSituations":"Reading a corrupted or truncated export directory; disk read errors on the import host; transfer interrupted by context timeout on very large pdirs.","solutions":["Note the badger path in the message and check that pdir for IO errors/corruption (badger check / open read-only).","Unwrap the inner error to see whether it came from the Send callback (network) or badger iteration (disk).","If disk-related, re-export the pdir from a healthy Alpha.","If network-related, fix connectivity and re-run the group's stream.","Give the context enough deadline for the full directory size."],"exampleFix":"// before\nif err := stream.Orchestrate(ctx); err != nil {\n\treturn fmt.Errorf(\"stream orchestration failed for group [%v]: %w, badger path: %s\", groupId, err, ps.Opts().Dir)\n}\n// after\nif err := stream.Orchestrate(ctx); err != nil {\n\tif ctx.Err() != nil {\n\t\treturn fmt.Errorf(\"orchestration for group %d timed out (dir %s): %w\", groupId, ps.Opts().Dir, ctx.Err())\n\t}\n\treturn fmt.Errorf(\"stream orchestration failed for group [%v]: %w, badger path: %s\", groupId, err, ps.Opts().Dir)\n}","handlingStrategy":"validation","validationCode":"db, err := badger.OpenManaged(badger.DefaultOptions(pdir).WithReadOnly(true).WithNumVersionsToKeep(math.MaxInt32))\nif err != nil {\n\treturn fmt.Errorf(\"pdir %s failed integrity precheck: %w\", pdir, err)\n}\nit := db.NewStreamAt(math.MaxUint64)\n_ = it.ChooseKey = nil // ensure stream can be built\n_ = db.Close()","typeGuard":null,"tryCatchPattern":"if err := stream.Orchestrate(ctx); err != nil {\n\tif errors.Is(err, badger.ErrDBClosed) || isIOError(err) {\n\t\treturn fmt.Errorf(\"re-export pdir %s; source data unreadable\", ps.Opts().Dir)\n\t}\n\treturn fmt.Errorf(\"stream orchestration failed for group [%v]: %w, badger path: %s\", groupId, err, ps.Opts().Dir)\n}","preventionTips":["Verify pdir integrity after export (open read-only, iterate a sample).","Check source-disk health on the import host.","Copy pdirs fully (rsync with checksums) before importing.","Set orchestration deadlines proportional to directory size."],"tags":["badger","stream","filesystem","snapshot-import"],"backgroundTag":"badger-stream-failed","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}