apache/beam · error

request has unexpected artifact type

Error message

request has unexpected artifact type %s

What it means

stageFiles returns this when the artifact request's type URN is not one of the supported values (Go worker binary URN or file type URN). It signals the artifact service sent an artifact type this SDK version does not know how to stage.

Solutions

  1. Upgrade the Beam Go SDK to a version supporting the new artifact type URN
  2. Check the %s in the error to identify the unsupported URN
  3. Ensure you are submitting a Go pipeline to this job server, not cross-language artifacts unsupported by staging
  4. Report the URN to the Beam project if it appears to be a standard type the SDK should handle

Example fix

// before
default:
  return errors.Errorf("request has unexpected artifact type %s", typeUrn)
// after: upgrade SDK so the URN is recognized, e.g. go get github.com/apache/beam/sdks/v2@v2.xx.0
Defensive patterns

Strategy: type-guard

Validate before calling

// verify supported URNs before staging
allowed := map[string]bool{graphx.URNArtifactGoWorker: true, graphx.URNArtifactFileType: true}

Type guard

func isSupportedArtifactUrn(urn string) bool {
  return urn == graphx.URNArtifactGoWorker || urn == graphx.URNArtifactFileType
}

Try / catch

if err := submit(...); err != nil && strings.Contains(err.Error(), "unexpected artifact type") {
  // upgrade SDK to support the URN printed in the error
}

Prevention

When it happens

Trigger: The staging stream delivers an ArtifactRequest whose GetTypeUrn() matches neither graphx.URNArtifactGoWorker nor graphx.URNArtifactFileType, hitting the default case of the type-URN switch.

Common situations: Version skew: newer runner/job server introduces new artifact type URNs unknown to the older Go SDK; or a non-Go artifact set (e.g. Python or Java artifacts) is staged against a Go pipeline session.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/b959466bc8314d79. Report an issue: GitHub.

Appendix: source

Thrown at sdks/go/pkg/beam/runners/universal/runnerlib/stage.go:134

					if err == io.EOF {
						continue // so we can get the real error from stream.Recv.
					}
					return errors.Wrapf(err, "failed to stage Go worker binary: %v", binary)
				}
			case graphx.URNArtifactFileType:
				typePl := pipepb.ArtifactFilePayload{}
				if err := proto.Unmarshal(request.GetArtifact.Artifact.TypePayload, &typePl); err != nil {
					return errors.Wrap(err, "failed to parse artifact file payload")
				}
				if err := stageFile(typePl.GetPath(), stream); err != nil {
					if err == io.EOF {
						continue // so we can get the real error from stream.Recv.
					}
					return errors.Wrapf(err, "failed to stage file %v", typePl.GetPath())

				}
			default:
				return errors.Errorf("request has unexpected artifact type %s", typeUrn)
			}

		default:
			return errors.Errorf("request has unexpected type %T", request)
		}
	}
}

func stageFile(filename string, stream jobpb.ArtifactStagingService_ReverseArtifactRetrievalServiceClient) error {
	fd, err := os.Open(filename)
	if err != nil {
		return errors.Wrapf(err, "unable to open file %v", filename)
	}
	defer fd.Close()

	data := make([]byte, 1<<20)
	for {
		n, err := fd.Read(data)

View on GitHub (pinned to 12126d8942)