{"record":{"id":"27554e6b6ada13a2","repo":"apache/beam","slug":"could-not-get-value-coder","errorCode":null,"errorMessage":"Could not get value Coder","messagePattern":"Could not get value Coder","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/cdap/src/main/java/org/apache/beam/sdk/io/cdap/CdapIO.java","lineNumber":356,"sourceCode":"        Long pullFrequencySec = getPullFrequencySec();\n        if (pullFrequencySec != null) {\n          reader = reader.withPullFrequencySec(pullFrequencySec);\n        }\n        Long startPollTimeoutSec = getStartPollTimeoutSec();\n        if (startPollTimeoutSec != null) {\n          reader = reader.withStartPollTimeoutSec(startPollTimeoutSec);\n        }\n        Long startOffset = getStartOffset();\n        if (startOffset != null) {\n          reader = reader.withStartOffset(startOffset);\n        }\n        try {\n          Coder<V> coder = input.getPipeline().getCoderRegistry().getCoder(valueClass);\n          PCollection<V> values = input.apply(reader).setCoder(coder);\n          SerializableFunction<V, KV<K, V>> fn = input1 -> KV.of(null, input1);\n          return values.apply(MapElements.into(new TypeDescriptor<KV<K, V>>() {}).via(fn));\n        } catch (CannotProvideCoderException e) {\n          throw new IllegalStateException(\"Could not get value Coder\", e);\n        }\n      } else {\n        cdapPlugin.withHadoopConfiguration(keyClass, valueClass).prepareRun();\n        Configuration hConf = cdapPlugin.getHadoopConfiguration();\n        HadoopFormatIO.Read<K, V> readFromHadoop =\n            HadoopFormatIO.<K, V>read().withConfiguration(hConf);\n        return input.apply(readFromHadoop);\n      }\n    }\n  }\n\n  /** A {@link PTransform} to write to CDAP sink. */\n  @AutoValue\n  @AutoValue.CopyAnnotations\n  public abstract static class Write<K, V> extends PTransform<PCollection<KV<K, V>>, PDone> {\n\n    abstract @Nullable PluginConfig getPluginConfig();\n","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/cdap/src/main/java/org/apache/beam/sdk/io/cdap/CdapIO.java#L338-L374","documentation":"In CdapIO.expand for the read path, the connector attempts to obtain a Coder for the value type from the pipeline's CoderRegistry. If the registry cannot provide a coder (CannotProvideCoderException), an IllegalStateException wrapping the cause is thrown.","triggerScenarios":"Using CdapIO.read() with a value type V that has no registered/default coder (custom class without codable structure) in the Beam pipeline.","commonSituations":"Reading records into a custom POJO/class that Beam cannot infer a coder for; missing registration of a custom Coder in the CoderRegistry.","solutions":["Register a coder for the value type in the pipeline's CoderRegistry.","Make the value type a standard codable type (e.g. String, Long, byte[], TableRow) or implement a Coder<V> and supply it via setCoder after the read.","Implement Serializable/`@DefaultSchema` annotations so Beam can infer a coder automatically."],"exampleFix":"// before\nCdapIO.<String, MyPojo>read()...\n// after\npipeline.getCoderRegistry().registerCoderForClass(MyPojo.class, new MyPojoCoder());\nCdapIO.<String, MyPojo>read()...","handlingStrategy":"validation","validationCode":"try {\n  pipeline.getCoderRegistry().getCoder(valueClass);\n} catch (CannotProvideCoderException e) {\n  pipeline.getCoderRegistry().registerCoderForClass(valueClass, new MyValueCoder());\n}","typeGuard":null,"tryCatchPattern":"try { pipeline.run().waitUntilFinish(); } catch (IllegalStateException e) { if (e.getMessage().equals(\"Could not get value Coder\")) { /* register coder */ } throw e; }","preventionTips":["Prefer standard codable value types.","Register custom coders at pipeline construction time.","Test pipelines with --runner=DirectRunner to catch coder issues early."],"tags":["java","apache-beam","cdap","coder"],"backgroundTag":"missing-config-value","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"}