{"record":{"id":"272e744fd3df815a","repo":"apache/beam","slug":"request-has-unexpected-type-t","errorCode":null,"errorMessage":"request has unexpected type %T","messagePattern":"request has unexpected type %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/runners/universal/runnerlib/stage.go","lineNumber":138,"sourceCode":"\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()\n\n\tdata := make([]byte, 1<<20)\n\tfor {\n\t\tn, err := fd.Read(data)\n\t\tif n > 0 {\n\t\t\tsendErr := stream.Send(&jobpb.ArtifactResponseWrapper{\n\t\t\t\tResponse: &jobpb.ArtifactResponseWrapper_GetArtifactResponse{\n\t\t\t\t\tGetArtifactResponse: &jobpb.GetArtifactResponse{","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/runners/universal/runnerlib/stage.go#L120-L156","documentation":"stageFiles returns this when the streaming request from the artifact service is neither an ArtifactRequest nor another recognized oneof member, hitting the outer default case. It indicates a malformed or unknown message type on the staging stream.","triggerScenarios":"stream.Recv() yields a ReverseArtifactRetrievalServiceResponse whose oneof is not GetArtifact — protocol incompatibility or a corrupted/garbage response from the server.","commonSituations":"SDK/JobService protobuf version mismatch (server sends message shapes the client's generated code doesn't recognize), or a non-Beam service on the artifact endpoint.","solutions":["Align Beam Go SDK and job server versions","Verify the artifact endpoint actually hosts a Beam ArtifactStagingService","Capture the %T type in the error and compare against the current JobApi protobuf definitions","Retry staging after upgrading; if persistent, file an issue with the type name"],"exampleFix":"// before\ndefault:\n  return errors.Errorf(\"request has unexpected type %T\", request)\n// after: upgrade SDK/job server to matching versions so the oneof shapes line up, then resubmit","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"func isKnownStagingResponse(resp *jobpb.ReverseArtifactRetrievalServiceResponse) bool {\n  return resp.GetArtifact() != nil // oneof member the SDK can handle\n}","tryCatchPattern":"if err := submit(...); err != nil && strings.Contains(err.Error(), \"request has unexpected type \") {\n  // %T in err names the unknown message type: fix version skew\n}","preventionTips":["Keep generated JobApi protobufs in sync with the job server","Verify the artifact endpoint is a real Beam ArtifactStagingService","Test cross-version compatibility before upgrading either side"],"tags":["grpc","protobuf","artifact-staging","version-skew"],"backgroundTag":"unexpected-response-shape","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"}