{"record":{"id":"570666f925f46b05","repo":"apache/beam","slug":"expected-single-value-map-had-v-v","errorCode":null,"errorMessage":"expected single value map, had %v - %v","messagePattern":"expected single value map, had (.+?) - (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/runners/prism/internal/execute.go","lineNumber":425,"sourceCode":"\tc := coders[coldCId]\n\tif c.GetSpec().GetUrn() == urns.CoderKV {\n\t\treturn c.GetComponentCoderIds()[0], true\n\t}\n\treturn \"\", false\n}\n\nfunc getWindowValueCoders(comps *pipepb.Components, col *pipepb.PCollection, coders map[string]*pipepb.Coder) (engine.WinCoderType, exec.WindowDecoder, exec.WindowEncoder) {\n\tws := comps.GetWindowingStrategies()[col.GetWindowingStrategyId()]\n\twcID, err := lpUnknownCoders(ws.GetWindowCoderId(), coders, comps.GetCoders())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn makeWindowCoders(coders[wcID])\n}\n\nfunc getOnlyPair[K comparable, V any](in map[K]V) (K, V) {\n\tif len(in) != 1 {\n\t\tpanic(fmt.Sprintf(\"expected single value map, had %v - %v\", len(in), in))\n\t}\n\tfor k, v := range in {\n\t\treturn k, v\n\t}\n\tpanic(\"unreachable\")\n}\n\nfunc getOnlyValue[K comparable, V any](in map[K]V) V {\n\t_, v := getOnlyPair(in)\n\treturn v\n}\n\n// buildTrigger converts the protocol buffer representation of a trigger\n// to the engine representation.\nfunc buildTrigger(tpb *pipepb.Trigger) engine.Trigger {\n\tswitch at := tpb.GetTrigger().(type) {\n\tcase *pipepb.Trigger_AfterAll_:\n\t\tsubTriggers := make([]engine.Trigger, 0, len(at.AfterAll.GetSubtriggers()))","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/runners/prism/internal/execute.go#L407-L443","documentation":"getOnlyPair is a generic helper asserting a map has exactly one entry (used e.g. to fetch the single input/output of a transform). If the map has zero or multiple entries, prism panics with the length and full map contents because the expected structural invariant of the pipeline graph is violated.","triggerScenarios":"getOnlyValue (or getOnlyPair) is called on a transform's inputs/outputs map that contains 0 or 2+ PCollection IDs — e.g. a Combine or other transform expected to be single-input/single-output but wired with extra side inputs or multiple outputs.","commonSituations":"Composite transforms producing unexpected arity, cross-language expansion yielding extra edges, or pipeline graph anomalies from optimizer/sibling-runner submissions.","solutions":["Identify the transform from the map contents in the panic and check its expected input/output arity.","Ensure transforms consuming this helper (like Combine) are not given additional side inputs.","Inspect the expanded pipeline JSON to see why the map has multiple entries; restructure the pipeline accordingly.","File a Beam issue if a standard transform triggers it — likely a graph-construction bug."],"exampleFix":"// before\npc := beam.ParDo(s, fn, input, other) // adds extra input edge breaking single-input assumption\n// after\nres := beam.Combine(s, fn, input) // keep the combine single-input","handlingStrategy":"validation","validationCode":"// Check map arity before calling getOnlyPair\nif len(inputs) != 1 {\n    return fmt.Errorf(\"expected single input, got %d\", len(inputs))\n}","typeGuard":"func isSingleEntry[K comparable, V any](m map[K]V) bool { return len(m) == 1 }","tryCatchPattern":"func safeGetOnlyPair[K comparable, V any](m map[K]V) (k K, v V, recovered any) {\n    defer func() { recovered = recover() }()\n    k, v = getOnlyPair(m)\n    return\n}","preventionTips":["Don't add side inputs to transforms assumed single-input","Inspect expansion output for unexpected extra edges","Validate pipeline graph arity before submission"],"tags":["go","panic","pipeline-graph","invariant","beam-prism"],"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-20T03:17:13.778Z"}