{"record":{"id":"9705dbc0a25801df","repo":"apache/beam","slug":"base64-decode-for-v-failed","errorCode":null,"errorMessage":"base64 decode for %v failed","messagePattern":"base64 decode for (.+?) failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/dataflow.go","lineNumber":364,"sourceCode":"\t\tschm := &pipepb.Schema{}\n\t\tif err := protox.DecodeBase64(subC.Type, schm); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tt, err := schema.ToType(schm)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn &coder.Coder{Kind: coder.Row, T: typex.New(t)}, nil\n\n\tdefault:\n\t\treturn nil, errors.Errorf(\"custom coders must be length prefixed: %+v\", c)\n\t}\n}\n\nfunc decodeDataflowCustomCoder(payload string) (*coder.Coder, error) {\n\tvar ref v1pb.CustomCoder\n\tif err := protox.DecodeBase64(payload, &ref); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"base64 decode for %v failed\", payload)\n\t}\n\tcustom, err := decodeCustomCoder(&ref)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tt := typex.New(custom.Type)\n\treturn &coder.Coder{Kind: coder.Custom, T: t, Custom: custom}, nil\n}\n\nfunc isCoGBKList(ref *CoderRef) ([]*CoderRef, bool) {\n\tif ref.Type != lengthPrefixType {\n\t\treturn nil, false\n\t}\n\tref2 := ref.Components[0]\n\tif ref2.Type != cogbklistType {\n\t\treturn nil, false\n\t}\n\treturn ref2.Components, true","sourceCodeStart":346,"sourceCodeEnd":382,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/dataflow.go#L346-L382","documentation":"decodeDataflowCustomCoder decodes the base64-encoded payload of a custom coder reference into a v1pb.CustomCoder proto. This error wraps a failure of protox.DecodeBase64, meaning the payload string is not valid base64 or not a valid protobuf encoding of CustomCoder.","triggerScenarios":"Calling DecodeCoderRef on a coder ref whose custom-coder payload string was corrupted, truncated, double-encoded, or not produced by the corresponding encodeDataflowCustomCoder.","commonSituations":"Hand-editing serialized pipeline JSON; transporting pipeline specs through channels that mangle strings (HTML-escaping, newline wrapping); version mismatch where the payload format changed.","solutions":["Regenerate the pipeline serialization instead of editing the payload by hand.","Verify the payload is standard (not URL-safe/unpadded variant mismatch) base64 of a CustomCoder proto.","Check that the pipeline spec wasn't transformed by a layer that escapes or rewrites strings (e.g. HTML templates, YAML).","Align SDK versions on both sides of job submission."],"exampleFix":"// before: hand-crafted payload\nref := &CoderRef{Payload: \"<pasted string>\"}\n// after: round-trip via the library\nw, err := graphx.EncodeCoderRef(coder)\n...","handlingStrategy":"validation","validationCode":"if _, err := base64.StdEncoding.DecodeString(payload); err != nil {\n    return fmt.Errorf(\"custom coder payload is not valid base64: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err != nil {\n    if strings.Contains(err.Error(), \"base64 decode\") {\n        // regenerate pipeline spec instead of retrying\n    }\n}","preventionTips":["Never hand-edit serialized pipeline specs","Avoid transport layers that rewrite strings (HTML escaping, line wrapping)","Round-trip coder refs through graphx.Encode/Decode in tests"],"tags":["go","beam","base64","protobuf"],"backgroundTag":"protobuf-unmarshal-failed","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"}