{"record":{"id":"bb3c73f0fd760e3a","repo":"apache/beam","slug":"failed-to-create-artifact-role-payload","errorCode":null,"errorMessage":"failed to create artifact role payload","messagePattern":"failed to create artifact role payload","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/artifact/materialize.go","lineNumber":141,"sourceCode":"\t\t\t}\n\t\t\tfilePayload.Sha256 = typePayload.Sha256\n\t\t}\n\t\tnewTypePayload, err := proto.Marshal(&filePayload)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"failed to create artifact type payload\")\n\t\t}\n\t\tartifacts = append(artifacts, &pipepb.ArtifactInformation{\n\t\t\tTypeUrn:     URNFileArtifact,\n\t\t\tTypePayload: newTypePayload,\n\t\t\tRoleUrn:     dep.RoleUrn,\n\t\t\tRolePayload: dep.RolePayload,\n\t\t})\n\n\t\trolePayload, err := proto.Marshal(&pipepb.ArtifactStagingToRolePayload{\n\t\t\tStagedName: path,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"failed to create artifact role payload\")\n\t\t}\n\t\tlist = append(list, &artifact{\n\t\t\tclient: client,\n\t\t\tdep: &pipepb.ArtifactInformation{\n\t\t\t\tTypeUrn:     dep.TypeUrn,\n\t\t\t\tTypePayload: dep.TypePayload,\n\t\t\t\tRoleUrn:     URNStagingTo,\n\t\t\t\tRolePayload: rolePayload,\n\t\t\t},\n\t\t\texpectedSha256: filePayload.Sha256,\n\t\t})\n\t}\n\n\treturn artifacts, MultiRetrieve(ctx, 10, list, dest)\n}\n\n// Used for generating unique IDs. We assign uniquely generated names to staged files without staging names.\nvar idCounter uint64","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/artifact/materialize.go#L123-L159","documentation":"Thrown in newMaterializeWithClient when proto.Marshal of an ArtifactStagingToRolePayload fails while building the retrievable artifact list. The library serializes the resolved staging-to role for every dependency returned by ResolveArtifacts; a marshal failure of this simple in-memory message indicates a serialization-layer problem rather than user input. The underlying protobuf error is wrapped by this message.","triggerScenarios":"Calling artifact.Materialize (or newMaterializeWithClient via tests) when proto.Marshal of &pipepb.ArtifactStagingToRolePayload{StagedName: path} fails during iteration over resolution.Replacements. Practically this only occurs if proto registry state is corrupted, a required marshaler (protoimpl) fails to initialize, or marshal options are incompatible.","commonSituations":"Very rare in practice: broken proto runtime registration (e.g. linking two incompatible versions of google.golang.org/protobuf), a custom binary downgraded proto library, or internal invariant violation in the protobuf runtime. Users essentially never cause this via configuration.","solutions":["Check google.golang.org/protobuf version conflicts in go.mod (go mod graph | grep protobuf) and align to a single consistent version.","Rebuild with a clean module cache (go clean -modcache && go mod download) to fix corrupted generated proto code.","Regenerate or refresh beam's pipeline_v1 protos by upgrading the beam SDK module to the latest patch version.","File an issue with the wrapped underlying error if it persists, as this indicates a protobuf runtime bug."],"exampleFix":"// before: mixed protobuf modules\nrequire google.golang.org/protobuf v1.25.0 // indirect\n// after: upgrade to compatible version used by beam\nrequire google.golang.org/protobuf v1.33.0","handlingStrategy":"try-catch","validationCode":"// Ensure a single protobuf version before running:\n// go run golang.org/x/tools/cmd/goimports -l . && go mod tidy\n// go list -m all | grep google.golang.org/protobuf\nimport \"google.golang.org/protobuf/proto\"\nif _, err := proto.Marshal(&pipepb.ArtifactStagingToRolePayload{StagedName: \"probe\"}); err != nil {\n\tlog.Fatalf(\"protobuf runtime broken: %v\", err)\n}","typeGuard":"func canMarshalProtos() bool {\n\t_, err := proto.Marshal(&pipepb.ArtifactStagingToRolePayload{StagedName: \"probe\"})\n\treturn err == nil\n}","tryCatchPattern":"arts, err := artifact.Materialize(ctx, endpoint, deps, rt, dest)\nif err != nil {\n\tif strings.Contains(err.Error(), \"failed to create artifact role payload\") {\n\t\t// protobuf runtime issue: fail fast with cause\n\t\tlog.Fatalf(\"proto marshal failure (check protobuf version pinning): %v\", err)\n\t}\n\treturn err\n}","preventionTips":["Pin one google.golang.org/protobuf version across all modules.","Run go mod tidy and go list -m all in CI to detect version skew.","Smoke-test proto marshal at startup to fail fast on runtime issues."],"tags":["go","protobuf","serialization","beam-artifacts"],"backgroundTag":"json-marshal-failed","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}