{"record":{"id":"c53360993c331459","repo":"apache/beam","slug":"invalid-to-nest-windowedvalue","errorCode":null,"errorMessage":"Invalid to nest WindowedValue","messagePattern":"Invalid to nest WindowedValue","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/typex/fulltype.go","lineNumber":138,"sourceCode":"\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"Unexpected aggregate type: %v\", t))\n\t\t}\n\tcase Composite:\n\t\tswitch t {\n\t\tcase KVType:\n\t\t\tif len(components) != 2 {\n\t\t\t\tpanic(fmt.Sprintf(\"Invalid number of components for KV: %v, %v\", t, components))\n\t\t\t}\n\t\t\tif isAnyNonKVAndNonWindowedComposite(components) {\n\t\t\t\tpanic(fmt.Sprintf(\"Invalid to nest composite composites inside KV: %v, %v\", t, components))\n\t\t\t}\n\t\t\treturn &tree{class, t, components}\n\t\tcase WindowedValueType:\n\t\t\tif len(components) != 1 {\n\t\t\t\tpanic(\"Invalid number of components for WindowedValue\")\n\t\t\t}\n\t\t\tif components[0].Type() == WindowedValueType {\n\t\t\t\tpanic(\"Invalid to nest WindowedValue\")\n\t\t\t}\n\t\t\treturn &tree{class, t, components}\n\t\tcase CoGBKType:\n\t\t\tif len(components) < 2 {\n\t\t\t\tpanic(fmt.Sprintf(\"Invalid number of components for CoGBK: %v\", t))\n\t\t\t}\n\t\t\tif isAnyNonKVComposite(components) {\n\t\t\t\tpanic(fmt.Sprintf(\"Invalid to nest composites inside CoGBK: %v\", t))\n\t\t\t}\n\t\t\treturn &tree{class, t, components}\n\t\tcase TimersType:\n\t\t\treturn &tree{class, t, components}\n\t\tcase ShardedKeyType:\n\t\t\tif len(components) != 1 {\n\t\t\t\tpanic(fmt.Sprintf(\"Invalid number of components for ShardedKey: %v, %v\", t, components))\n\t\t\t}\n\t\t\tif components[0].Class() == Composite {\n\t\t\t\tpanic(fmt.Sprintf(\"Invalid to nest composite inside ShardedKey: %v, %v\", t, components))","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/typex/fulltype.go#L120-L156","documentation":"FullType.New forbids a WindowedValue component whose own element is another WindowedValue; nesting windowing wrappers is unsupported and panics. Window metadata exists at most once per value in the SDK's type model.","triggerScenarios":"Calling typex.New with WindowedValueType where components[0].Type() == WindowedValueType — i.e. the wrapped element is itself windowed, typically after multiple windowing passes or manual re-wrapping of already-windowed types.","commonSituations":"Applying beam.WindowInto to a PCollection already producing WindowedValue types; custom transforms re-wrapping values with additional window metadata.","solutions":["Remove the redundant windowing step; window a PCollection only once.","Unwrap to the inner element type before applying another WindowInto.","If layered windowing semantics are needed, merge window assignments instead of nesting types."],"exampleFix":"// before\ntypex.New(typex.WindowedValueType, typex.New(typex.WindowedValueType, elemFT)) // nested: panics\n// after\ntypex.New(typex.WindowedValueType, elemFT)","handlingStrategy":"validation","validationCode":"if components[0].Type() == typex.WindowedValueType {\n\treturn errors.New(\"cannot nest WindowedValue inside WindowedValue\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Apply windowing at most once per PCollection.","Unwrap windowed types before re-windowing; merge window assignments instead of layering."],"tags":["go","beam","typex","windowing","nesting","panic"],"backgroundTag":"invalid-state-transition","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"}