{"record":{"id":"4ca4371b601fe3b7","repo":"apache/beam","slug":"could-not-unmarshal-coderref-from-v-failed-to-decode-urn","errorCode":null,"errorMessage":"could not unmarshal CoderRef from %v, failed to decode urn-less coder's payload \"%v\"","messagePattern":"could not unmarshal CoderRef from (.+?), failed to decode urn-less coder's payload \"(.+?)\"","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/coder.go","lineNumber":334,"sourceCode":"\t\tif urn == urnWindowedValueCoder {\n\t\t\treturn wvc, nil\n\t\t}\n\t\twvc.Kind = coder.ParamWindowedValue\n\t\twvc.Window.Payload = string(c.GetSpec().GetPayload())\n\t\treturn wvc, nil\n\n\tcase streamType:\n\t\treturn nil, errors.Errorf(\"could not unmarshal stream type coder from %v, stream must be pair value\", c)\n\n\tcase \"\":\n\t\t// TODO(herohde) 11/27/2017: we still see CoderRefs from Dataflow. Handle that\n\t\t// case here, for now, so that the harness can use this logic.\n\n\t\tpayload := c.GetSpec().GetPayload()\n\n\t\tvar ref CoderRef\n\t\tif err := json.Unmarshal(payload, &ref); err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"could not unmarshal CoderRef from %v, failed to decode urn-less coder's payload \\\"%v\\\"\", c, string(payload))\n\t\t}\n\t\tc, err := DecodeCoderRef(&ref)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"could not unmarshal CoderRef from %v, failed to decode CoderRef \\\"%v\\\"\", c, string(payload))\n\t\t}\n\t\treturn c, nil\n\n\tcase urnIterableCoder, urnStateBackedIterableCoder:\n\t\tif len(components) != 1 {\n\t\t\treturn nil, errors.Errorf(\"could not unmarshal iterable coder from %v, expected one component but got %d\", c, len(components))\n\t\t}\n\t\telm, err := b.Coder(components[0])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn coder.NewI(elm), nil\n\tcase urnTimerCoder:\n\t\tif len(components) != 2 {","sourceCodeStart":316,"sourceCodeEnd":352,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/coder.go#L316-L352","documentation":"A coder with an empty URN (urn-less CoderRef, often seen from legacy Dataflow) carries a JSON payload that failed to json.Unmarshal into a CoderRef struct. The payload is therefore not a valid serialized coder reference.","triggerScenarios":"Decoding a coder whose spec has no URN and whose payload is not valid CoderRef JSON (truncated, wrong fields, empty).","commonSituations":"Legacy Dataflow CoderRefs in pipeline graphs; corrupted pipeline files; payloads written by incompatible SDK versions.","solutions":["Log/inspect the raw payload to see why JSON parsing fails (truncation, wrong schema)","Re-serialize the pipeline with a compatible Go SDK version","Validate the pipeline JSON before submission","If legacy Dataflow, migrate to the portability/model pipeline format"],"exampleFix":"// before: payload with wrong JSON shape\n// after: ensure payload marshals graphx.CoderRef, e.g. {\"urn\":\"beam:coder:kv:v1\",\"components\":[...]}","handlingStrategy":"validation","validationCode":"var probe map[string]any\nif err := json.Unmarshal(payload, &probe); err != nil {\n    return fmt.Errorf(\"urn-less coder payload is not valid JSON: %w\", err)\n}\nif _, ok := probe[\"urn\"]; !ok {\n    return errors.New(\"urn-less coder payload missing 'urn' field\")\n}","typeGuard":null,"tryCatchPattern":"c, err := graphx.Coder(model, ref)\nif err != nil {\n    return fmt.Errorf(\"decoder could not parse CoderRef payload %q: %w\", payload, err)\n}","preventionTips":["Validate pipeline JSON payloads before submission","Keep producer and consumer SDK versions aligned","Migrate away from legacy Dataflow CoderRefs to the portability model"],"tags":["go","apache-beam","json","coder"],"backgroundTag":"json-unmarshal-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"}