{"record":{"id":"ece59b0fd99bbfda","repo":"apache/beam","slug":"failed-to-stage-file-v","errorCode":null,"errorMessage":"failed to stage file %v","messagePattern":"failed to stage file (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/runners/universal/runnerlib/stage.go","lineNumber":130,"sourceCode":"\t\t\t// TODO(https://github.com/apache/beam/issues/21459): Legacy Type URN. If requested, provide the binary.\n\t\t\t// To be removed later in 2022, once thoroughly obsolete.\n\t\t\tcase graphx.URNArtifactGoWorker:\n\t\t\t\tif err := stageFile(binary, stream); err != nil {\n\t\t\t\t\tif err == io.EOF {\n\t\t\t\t\t\tcontinue // so we can get the real error from stream.Recv.\n\t\t\t\t\t}\n\t\t\t\t\treturn errors.Wrapf(err, \"failed to stage Go worker binary: %v\", binary)\n\t\t\t\t}\n\t\t\tcase graphx.URNArtifactFileType:\n\t\t\t\ttypePl := pipepb.ArtifactFilePayload{}\n\t\t\t\tif err := proto.Unmarshal(request.GetArtifact.Artifact.TypePayload, &typePl); err != nil {\n\t\t\t\t\treturn errors.Wrap(err, \"failed to parse artifact file payload\")\n\t\t\t\t}\n\t\t\t\tif err := stageFile(typePl.GetPath(), stream); err != nil {\n\t\t\t\t\tif err == io.EOF {\n\t\t\t\t\t\tcontinue // so we can get the real error from stream.Recv.\n\t\t\t\t\t}\n\t\t\t\t\treturn errors.Wrapf(err, \"failed to stage file %v\", typePl.GetPath())\n\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn errors.Errorf(\"request has unexpected artifact type %s\", typeUrn)\n\t\t\t}\n\n\t\tdefault:\n\t\t\treturn errors.Errorf(\"request has unexpected type %T\", request)\n\t\t}\n\t}\n}\n\nfunc stageFile(filename string, stream jobpb.ArtifactStagingService_ReverseArtifactRetrievalServiceClient) error {\n\tfd, err := os.Open(filename)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"unable to open file %v\", filename)\n\t}\n\tdefer fd.Close()","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/runners/universal/runnerlib/stage.go#L112-L148","documentation":"stageFiles wraps the error from stageFile when staging a generic artifact file (URN graphx.URNArtifactFileType) fails after its path was successfully parsed from the ArtifactFilePayload. A non-EOF error means the file could not be opened or its chunks could not be sent over the staging stream.","triggerScenarios":"stageFile(typePl.GetPath(), stream) returns non-EOF: the artifact path does not exist locally, is unreadable, or stream.Send fails during chunked upload.","commonSituations":"Required artifacts (resources, extra packages) missing from the staging directory, permission problems on temp files, connection dropped mid-upload of large files.","solutions":["Check the wrapped error: if file open failed, verify the artifact path exists and is readable","Ensure all required dependencies/resources are included in the staging set","Retry on transient gRPC send errors (upper layer retries per attempt)","Verify disk space and permissions on the staging directory"],"exampleFix":"// before\nreturn errors.Wrapf(err, \"failed to stage file %v\", typePl.GetPath())\n// after: pre-check the file, e.g.\n// if _, err := os.Stat(path); err != nil { return fmt.Errorf(\"artifact missing: %w\", err) }","handlingStrategy":"validation","validationCode":"// pre-check all staged files exist and are readable\nfor _, f := range artifacts {\n  fh, err := os.Open(f)\n  if err != nil { return fmt.Errorf(\"artifact unreadable: %s: %w\", f, err) }\n  fh.Close()\n}","typeGuard":null,"tryCatchPattern":"if err := submit(...); err != nil && strings.Contains(err.Error(), \"failed to stage file \") {\n  // path is in err: verify it exists and retry on transient send errors\n}","preventionTips":["Include all required dependencies in the staging set","Check file permissions on the staging directory","Ensure sufficient disk space for large artifacts"],"tags":["artifact-staging","file-not-found","grpc","file-upload"],"backgroundTag":"file-not-found","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}