{"record":{"id":"382c5f5772b87e9f","repo":"apache/beam","slug":"could-not-use-the-provided-coder-implementation-when","errorCode":null,"errorMessage":"Could not use the provided `Coder` implementation when upgrading.Using the default.","messagePattern":"Could not use the provided `Coder` implementation when upgrading\\.Using the default\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIOTranslation.java","lineNumber":356,"sourceCode":"        if (timestampPrecisionBytes != null) {\n          builder =\n              builder.setDirectReadPicosTimestampPrecision(\n                  (TimestampPrecision) fromByteArray(timestampPrecisionBytes));\n        }\n        Collection<String> selectedFields = configRow.getArray(\"selected_fields\");\n        if (selectedFields != null && !selectedFields.isEmpty()) {\n          builder.setSelectedFields(StaticValueProvider.of(ImmutableList.of(selectedFields)));\n        }\n        String rowRestriction = configRow.getString(\"row_restriction\");\n        if (rowRestriction != null) {\n          builder = builder.setRowRestriction(StaticValueProvider.of(rowRestriction));\n        }\n        byte[] coderBytes = configRow.getBytes(\"coder\");\n        if (coderBytes != null) {\n          try {\n            builder = builder.setCoder((Coder) fromByteArray(coderBytes));\n          } catch (InvalidClassException e) {\n            LOG.warn(\n                \"Could not use the provided `Coder` implementation when upgrading.\"\n                    + \"Using the default.\");\n          }\n        }\n        String kmsKey = configRow.getString(\"kms_key\");\n        if (kmsKey != null) {\n          builder = builder.setKmsKey(kmsKey);\n        }\n        byte[] typeDescriptorBytes = configRow.getBytes(\"type_descriptor\");\n        if (typeDescriptorBytes != null) {\n          builder = builder.setTypeDescriptor((TypeDescriptor) fromByteArray(typeDescriptorBytes));\n        }\n        byte[] toBeamRowFnBytes = configRow.getBytes(\"to_beam_row_fn\");\n        if (toBeamRowFnBytes != null) {\n          builder = builder.setToBeamRowFn((ToBeamRowFunction) fromByteArray(toBeamRowFnBytes));\n        }\n        byte[] fromBeamRowFnBytes = configRow.getBytes(\"from_beam_row_fn\");\n        if (fromBeamRowFnBytes != null) {","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIOTranslation.java#L338-L374","documentation":"When translating a BigQueryIO Read transform back from its config Row, Beam attempts to restore a serialized custom Coder implementation. If deserialization fails with InvalidClassException (serialized class no longer matches), Beam logs this warning and continues using the transform's default Coder.","triggerScenarios":"readTransformFromRow -> fromConfigRow for a BigQueryIO.Read where the 'coder' config field contains bytes serialized by an incompatible class version (InvalidClassException from fromByteArray).","commonSituations":"SDK version upgrades where a custom Coder class changed between releases; replaying serialized pipeline definitions with a newer Beam version; custom coders without stable serialVersionUID.","solutions":["Regenerate the pipeline with the current SDK so the coder is re-serialized with the current class.","Add/align serialVersionUID on the custom Coder to keep deserialization compatible across versions.","Verify the default Coder fallback produces correct output; if not, explicitly call .setCoder(new YourCoder()) after building the transform.","Pin the Beam SDK version used to serialize and deserialize the pipeline to the same release."],"exampleFix":"// before\npublic class MyCoder extends CustomCoder<Row> { /* no serialVersionUID */ }\n// after\npublic class MyCoder extends CustomCoder<Row> {\n  private static final long serialVersionUID = 1L;\n}","handlingStrategy":"fallback","validationCode":"try { fromByteArray(coderBytes); } catch (InvalidClassException e) { /* use default coder */ }","typeGuard":"boolean coderBytesValid(byte[] b) { try { fromByteArray(b); return true; } catch (InvalidClassException e) { return false; } }","tryCatchPattern":"try { builder = builder.setCoder((Coder) fromByteArray(coderBytes)); } catch (InvalidClassException e) { LOG.warn(...); /* default coder retained */ }","preventionTips":["Fix serialVersionUID on custom Coder classes.","Regenerate serialized pipelines after SDK upgrades.","After fromConfigRow, assert the resulting transform uses the expected coder."],"tags":["bigquery","coder","serialization","upgrade"],"backgroundTag":"class-not-found","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"}