{"record":{"id":"5bfac28e1b751a95","repo":"apache/beam","slug":"checkpointcoder-uses-java-serialization-which-may-be-non","errorCode":null,"errorMessage":"CheckpointCoder uses Java Serialization, which may be non-deterministic.","messagePattern":"CheckpointCoder uses Java Serialization, which may be non-deterministic\\.","errorType":"validation","errorClass":"NonDeterministicException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/UnboundedReadFromBoundedSource.java","lineNumber":267,"sourceCode":"          throws CoderException, IOException {\n        elemsCoder.encode(value.residualElements, outStream);\n        sourceCoder.encode(value.residualSource, outStream);\n      }\n\n      @SuppressWarnings(\"unchecked\")\n      @Override\n      public Checkpoint<T> decode(InputStream inStream) throws CoderException, IOException {\n        return new Checkpoint<>(elemsCoder.decode(inStream), sourceCoder.decode(inStream));\n      }\n\n      @Override\n      public List<Coder<?>> getCoderArguments() {\n        return Arrays.asList(elemCoder);\n      }\n\n      @Override\n      public void verifyDeterministic() throws NonDeterministicException {\n        throw new NonDeterministicException(\n            this, \"CheckpointCoder uses Java Serialization, which may be non-deterministic.\");\n      }\n    }\n\n    /**\n     * An {@code UnboundedReader<T>} that wraps a {@code BoundedSource<T>} into {@link\n     * ResidualElements} and {@link ResidualSource}.\n     *\n     * <p>In the initial state, {@link ResidualElements} is null and {@link ResidualSource} contains\n     * the {@code BoundedSource<T>}. After the first checkpoint, the {@code BoundedSource<T>} will\n     * be split into {@link ResidualElements} and {@link ResidualSource}.\n     */\n    @VisibleForTesting\n    class Reader extends UnboundedReader<T> {\n      // Initialized in init()\n      private @Nullable ResidualElements residualElements;\n      private @Nullable ResidualSource residualSource;\n      private final PipelineOptions options;","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/UnboundedReadFromBoundedSource.java#L249-L285","documentation":"CheckpointCoder (used by UnboundedReadFromBoundedSource to checkpoint UnboundedReader state) relies on Java serialization, which is not guaranteed deterministic across JVMs/runs. Its verifyDeterministic override unconditionally throws Coder.NonDeterministicException to signal this, since Beam requires deterministic coders for key operations like grouping and caching.","triggerScenarios":"Calling verifyDeterministic() on a CheckpointCoder instance — e.g. when the pipeline framework validates coder determinism during Apply witnesses, GBK, or coder verification of a checkpointed unbounded read.","commonSituations":"Runners or pipeline validators that enforce deterministic coders encountering an unbounded source checkpoint; debugging coder determinism of BoundedSource-based reads.","solutions":["Do not use CheckpointCoder in contexts requiring deterministic coders; restructure so checkpoint state isn't coder-validated","Provide a deterministic coder for the checkpoint state if the runner supports customization","If the check is incidental, avoid operations (like GroupByKey) on PCollections coded with CheckpointCoder"],"exampleFix":"// before\ncheckpointCoder.verifyDeterministic(); // always throws\n// after: use a deterministic coder implementation for the state\nCoder<MyState> coder = new MyDeterministicStateCoder();","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  coder.verifyDeterministic();\n} catch (Coder.NonDeterministicException e) {\n  // CheckpointCoder (or its element coder) is non-deterministic; do not use it\n  // for GroupByKey/GBK-like operations requiring deterministic coders.\n}","preventionTips":["Never use CheckpointCoder for PCollections that undergo key-based operations","Substitute a deterministic coder for checkpoint state when the runner requires one"],"tags":["java","beam","coders","determinism"],"backgroundTag":"unsupported-operation","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"}