{"record":{"id":"318ef096d1f3f8a7","repo":"apache/beam","slug":"unable-to-deduce-single-value-from-valueset","errorCode":null,"errorMessage":"Unable to deduce single value from \" + valueSet","messagePattern":"Unable to deduce single value from \" \\+ valueSet","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/typescript/src/apache_beam/internal/pipeline.ts","lineNumber":343,"sourceCode":"\nfunction objectMap(obj, func) {\n  return Object.fromEntries(Object.entries(obj).map(([k, v]) => [k, func(v)]));\n}\n\nfunction onlyValueOr<T>(\n  valueSet: Set<T>,\n  defaultValue: T,\n  comparator: (a: T, b: T) => boolean = (a, b) => false,\n) {\n  if (valueSet.size === 0) {\n    return defaultValue;\n  } else if (valueSet.size === 1) {\n    return valueSet.values().next().value;\n  } else {\n    const candidate = valueSet.values().next().value;\n    for (const other of valueSet) {\n      if (!comparator(candidate, other)) {\n        throw new Error(\"Unable to deduce single value from \" + valueSet);\n      }\n    }\n    return candidate;\n  }\n}\n\nrequireForSerialization(`${packageName}/internal/pipeline`, exports);\n","sourceCodeStart":325,"sourceCodeEnd":351,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/typescript/src/apache_beam/internal/pipeline.ts#L325-L351","documentation":"onlyValueOr collected multiple candidate values in a Set and the caller-supplied comparator failed to deem them equivalent, so no single representative value could be deduced. The valueSet and the comparator are the inputs at fault; this is a generic consistency helper used during postApplyTransform to reconcile per-PCollection metadata (e.g. windowing or coders) that must agree.","triggerScenarios":"Thrown at sdks/typescript/src/apache_beam/internal/pipeline.ts:343 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the printed set to see which two values disagree, then make the producing transforms consistent (same windowing/coder on all inputs).","Pass a comparator that treats the differing values as equivalent if the discrepancy is benign and you control the call site.","Report a bug if identical-looking values still fail the comparator, since structural equality may be at fault."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}