{"record":{"id":"1116079c5dd96491","repo":"apache/beam","slug":"mismatch-d-counts-between-external-tags-v-and-outputs-v","errorCode":null,"errorMessage":"mismatch'd counts between External tags (%v) and outputs (%v)","messagePattern":"mismatch'd counts between External tags \\((.+?)\\) and outputs \\((.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/translate.go","lineNumber":703,"sourceCode":"\t\tpyld := edge.Edge.Payload\n\t\tspec = &pipepb.FunctionSpec{Urn: pyld.URN, Payload: pyld.Data}\n\n\t\tif len(pyld.InputsMap) != 0 {\n\t\t\tif got, want := len(pyld.InputsMap), len(edge.Edge.Input); got != want {\n\t\t\t\treturn handleErr(errors.Errorf(\"mismatch'd counts between External tags (%v) and inputs (%v)\", got, want))\n\t\t\t}\n\t\t\tinputs = make(map[string]string)\n\t\t\tfor tag, in := range InboundTagToNode(pyld.InputsMap, edge.Edge.Input) {\n\t\t\t\tif _, err := m.addNode(in); err != nil {\n\t\t\t\t\treturn handleErr(err)\n\t\t\t\t}\n\t\t\t\tinputs[tag] = nodeID(in)\n\t\t\t}\n\t\t}\n\n\t\tif len(pyld.OutputsMap) != 0 {\n\t\t\tif got, want := len(pyld.OutputsMap), len(edge.Edge.Output); got != want {\n\t\t\t\treturn handleErr(errors.Errorf(\"mismatch'd counts between External tags (%v) and outputs (%v)\", got, want))\n\t\t\t}\n\t\t\toutputs = make(map[string]string)\n\t\t\tfor tag, out := range OutboundTagToNode(pyld.OutputsMap, edge.Edge.Output) {\n\t\t\t\tif _, err := m.addNode(out); err != nil {\n\t\t\t\t\treturn handleErr(err)\n\t\t\t\t}\n\t\t\t\toutputs[tag] = nodeID(out)\n\t\t\t}\n\t\t}\n\n\tdefault:\n\t\terr := errors.Errorf(\"unexpected opcode: %v\", edge.Edge.Op)\n\t\treturn handleErr(err)\n\t}\n\n\tvar transformEnvID = \"\"\n\tif !(spec.Urn == URNGBK || spec.Urn == URNImpulse) {\n\t\ttransformEnvID = m.addDefaultEnv()","sourceCodeStart":685,"sourceCodeEnd":721,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/translate.go#L685-L721","documentation":"Same consistency check as inputs but for outputs: an External edge's OutputsMap tag count must equal the number of output PCollections on the edge. A mismatch means the external payload's declared outputs don't line up with the graph, so the marshaller returns this error via handleErr.","triggerScenarios":"Marshalling an External transform where len(pyld.OutputsMap) != len(edge.Edge.Output) — the payload declares more or fewer output tags than the graph node actually produces.","commonSituations":"Hand-crafted external payloads with wrong output arity; version drift in cross-language transforms where output schema changed; custom connectors with multiple outputs added/removed.","solutions":["Align OutputsMap entries with the actual number of edge outputs","Regenerate the external transform payload with the current SDK","Check OutboundTagToNode wiring so every tag maps to an output","If the transform arity changed, update the expansion payload and inputs map together"],"exampleFix":"// before\npyld := graph.Payload{URN: urn, OutputsMap: map[string]int{\"out\":0}} // 1 tag, 2 outputs\n// after\npyld := graph.Payload{URN: urn, OutputsMap: map[string]int{\"out\":0,\"metrics\":1}}","handlingStrategy":"validation","validationCode":"// Validate output tag arity before marshalling\nif len(pyld.OutputsMap) != 0 && len(pyld.OutputsMap) != len(edge.Output) {\n    return fmt.Errorf(\"external %q: %d tags vs %d outputs\", pyld.URN, len(pyld.OutputsMap), len(edge.Output))\n}","typeGuard":null,"tryCatchPattern":"if _, err := graphx.Marshal(p); err != nil {\n    if strings.Contains(err.Error(), \"External tags\") && strings.Contains(err.Error(), \"outputs\") {\n        return fmt.Errorf(\"external output map mismatch: %v\", err)\n    }\n    return err\n}","preventionTips":["Keep OutputsMap in sync whenever a cross-language transform's outputs change","Use expansion-service generated payloads rather than hand-written ones","Add a unit test that marshals any custom external transform"],"tags":["go","apache-beam","external-transform","cross-language"],"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-14T16:17:12.679Z"}