{"record":{"id":"1290de52359b041e","repo":"apache/seatunnel","slug":"a-decoding-format-must-override-this-method-to-app","errorCode":null,"errorMessage":"A decoding format must override this method to apply metadata keys.","messagePattern":"A decoding format must override this method to apply metadata keys\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"seatunnel-api/src/main/java/org/apache/seatunnel/api/table/connector/DeserializationFormat.java","lineNumber":36,"sourceCode":"package org.apache.seatunnel.api.table.connector;\n\nimport org.apache.seatunnel.api.serialization.DeserializationSchema;\nimport org.apache.seatunnel.api.table.type.SeaTunnelDataType;\n\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Map;\n\npublic interface DeserializationFormat {\n\n    DeserializationSchema createDeserializationSchema();\n\n    default Map<String, SeaTunnelDataType<?>> listReadableMetadata() {\n        return Collections.emptyMap();\n    }\n\n    default void applyReadableMetadata(List<String> metadataKeys, SeaTunnelDataType<?> dataType) {\n        throw new UnsupportedOperationException(\n                \"A decoding format must override this method to apply metadata keys.\");\n    }\n}\n","sourceCodeStart":18,"sourceCodeEnd":40,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/connector/DeserializationFormat.java#L18-L40","documentation":"DeserializationFormat.applyReadableMetadata is a default method that intentionally throws UnsupportedOperationException. A format that can decode records (decoding format) must override it to propagate requested metadata keys into the produced data type; the default exists only for formats that never support metadata.","triggerScenarios":"A Source using metadata (e.g. via SourceReader with readableMetadata) whose configured format (Factory's DeserializationFormat) did not override applyReadableMetadata — the engine calls the default and fails.","commonSituations":"Requesting metadata columns (like table name or partition info from Kafka-style connectors) with a format plugin that lacks metadata support, or a custom format implementation missing the override after upgrading the API.","solutions":["Override applyReadableMetadata in your DeserializationFormat implementation","Choose a format that supports the requested metadata keys","Remove the metadata keys from the source config if the format cannot supply them"],"exampleFix":"// before\nclass MyFormat implements DeserializationFormat { /* no override */ }\n// after\n@Override\npublic void applyReadableMetadata(List<String> metadataKeys, SeaTunnelDataType<?> dataType) {\n    // merge metadataKeys into produced row type\n}","handlingStrategy":"try-catch","validationCode":"if (format.listReadableMetadata().isEmpty() && !metadataKeys.isEmpty())\n    throw new IllegalArgumentException(\"Format does not support metadata keys: \" + metadataKeys);","typeGuard":"boolean supportsMetadata = !format.listReadableMetadata().isEmpty();","tryCatchPattern":"try { format.applyReadableMetadata(keys, dataType); } catch (UnsupportedOperationException e) { // fall back: drop metadata keys or switch format\n    dataType = dataTypeWithoutMetadata(); }","preventionTips":["Only request metadata keys listed by listReadableMetadata()","Override applyReadableMetadata when implementing custom decoding formats","Check format capabilities before configuring metadata columns"],"tags":["unsupported-operation","format","metadata"],"backgroundTag":"method-not-implemented","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}