{"record":{"id":"55b9316c3150ccc3","repo":"apache/beam","slug":"unable-to-encode-constant-members-of-paramwindowedvaluecoder","errorCode":null,"errorMessage":"Unable to encode constant members of ParamWindowedValueCoder: ","messagePattern":"Unable to encode constant members of ParamWindowedValueCoder: ","errorType":"exception","errorClass":"java.lang.RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/values/WindowedValues.java","lineNumber":1456,"sourceCode":"      // ParamWindowedValueCoder\n      ByteArrayOutputStream baos = new ByteArrayOutputStream();\n      WindowedValue<byte[]> windowedValue =\n          WindowedValues.of(\n              EMPTY_BYTES,\n              from.getTimestamp(),\n              from.getWindows(),\n              from.getPaneInfo(),\n              null,\n              null,\n              CausedByDrain.NORMAL,\n              null,\n              from.getValueKind());\n      WindowedValues.FullWindowedValueCoder<byte[]> windowedValueCoder =\n          WindowedValues.FullWindowedValueCoder.of(ByteArrayCoder.of(), from.getWindowCoder());\n      try {\n        windowedValueCoder.encode(windowedValue, baos);\n      } catch (IOException e) {\n        throw new RuntimeException(\n            \"Unable to encode constant members of ParamWindowedValueCoder: \", e);\n      }\n      return baos.toByteArray();\n    }\n\n    /** Create a {@link Coder} from its component {@link Coder coders}. */\n    public static WindowedValues.ParamWindowedValueCoder<?> fromComponents(\n        List<Coder<?>> components, byte[] payload) {\n      Coder<? extends BoundedWindow> windowCoder =\n          (Coder<? extends BoundedWindow>) components.get(1);\n      WindowedValues.FullWindowedValueCoder<byte[]> windowedValueCoder =\n          WindowedValues.FullWindowedValueCoder.of(ByteArrayCoder.of(), windowCoder);\n\n      try {\n        ByteArrayInputStream bais = new ByteArrayInputStream(payload);\n        WindowedValue<byte[]> windowedValue = windowedValueCoder.decode(bais);\n        return WindowedValues.ParamWindowedValueCoder.of(\n            components.get(0),","sourceCodeStart":1438,"sourceCodeEnd":1474,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/values/WindowedValues.java#L1438-L1474","documentation":"ParamWindowedValueCoder encodes its constant members (timestamp, windows, pane info, value kind) to a byte payload during serialization; if FullWindowedValueCoder.encode() throws IOException it is rethrown as a RuntimeException with this message. It signals the sample windowed value could not be serialized while constructing the coder.","triggerScenarios":"Constructing a ParamWindowedValueCoder (e.g., via its constructor from an existing WindowedValue) where windowedValueCoder.encode(windowedValue, baos) fails with IOException, usually because the value or window coder cannot serialize the given element.","commonSituations":"Custom window types without a proper Coder; values with non-serializable fields when Java serialization crosses worker boundaries; mismatched coder versions after a Beam upgrade.","solutions":["Check the 'Caused by' IOException to see which component coder failed","Ensure the window Coder can serialize all custom windows used","Verify the value's coder is registered and stable across job submission and workers","Keep Beam SDK versions identical between submitter and expansion/worker environments"],"exampleFix":"// before: custom window without registered coder\nMyCustomWindow w = new MyCustomWindow(...);\n// after: provide a custom window coder\npipeline.getCoderRegistry().registerCoderForClass(MyCustomWindow.class, MyCustomWindowCoder.of());","handlingStrategy":"validation","validationCode":"Coder<T> coder = pipeline.getCoderRegistry().getCoder(valueType);\nif (coder == null) throw new IllegalStateException(\"No registered coder for \" + valueType);","typeGuard":null,"tryCatchPattern":"try { ParamWindowedValueCoder.of(...); } catch (RuntimeException e) { if (e.getCause() instanceof IOException) { /* coder encoding failure: fix component coder */ } throw e; }","preventionTips":["Register coders for all custom window and value types","Test coder round-trips (encode then decode) in unit tests","Keep Beam versions consistent across environments"],"tags":["java","beam","coder","serialization","ioexception"],"backgroundTag":"json-marshal-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"}