{"record":{"id":"32db719ff68961ff","repo":"apache/seatunnel","slug":"unsupported-type-type","errorCode":null,"errorMessage":"Unsupported type ${type}","messagePattern":"Unsupported type (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/main/java/org/apache/seatunnel/engine/imap/storage/file/wal/DiscoveryWalFileFactory.java","lineNumber":40,"sourceCode":"import org.apache.seatunnel.engine.imap.storage.file.config.FileConfiguration;\nimport org.apache.seatunnel.engine.imap.storage.file.wal.reader.DefaultReader;\nimport org.apache.seatunnel.engine.imap.storage.file.wal.reader.IFileReader;\nimport org.apache.seatunnel.engine.imap.storage.file.wal.writer.HdfsWriter;\nimport org.apache.seatunnel.engine.imap.storage.file.wal.writer.IFileWriter;\nimport org.apache.seatunnel.engine.imap.storage.file.wal.writer.OssWriter;\nimport org.apache.seatunnel.engine.imap.storage.file.wal.writer.S3Writer;\n\npublic class DiscoveryWalFileFactory {\n\n    public static IFileReader getReader(String type) {\n        FileConfiguration configuration = FileConfiguration.valueOf(type.toUpperCase());\n        switch (configuration) {\n            case HDFS:\n            case S3:\n            case OSS:\n                return new DefaultReader();\n        }\n        throw new UnsupportedOperationException(\"Unsupported type \" + type);\n    }\n\n    public static IFileWriter getWriter(String type) {\n        FileConfiguration configuration = FileConfiguration.valueOf(type.toUpperCase());\n        switch (configuration) {\n            case HDFS:\n                return new HdfsWriter();\n            case S3:\n                return new S3Writer();\n            case OSS:\n                return new OssWriter();\n        }\n        throw new UnsupportedOperationException(\"Unsupported type \" + type);\n    }\n}\n","sourceCodeStart":22,"sourceCodeEnd":56,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/main/java/org/apache/seatunnel/engine/imap/storage/file/wal/DiscoveryWalFileFactory.java#L22-L56","documentation":"UnsupportedOperationException thrown by DiscoveryWalFileFactory.getReader when the configured storage `type` does not map to a known FileConfiguration enum value (HDFS, S3, OSS). getReader validates the type and only returns a DefaultReader for the three supported backends; anything else falls through to this throw.","triggerScenarios":"Calling DiscoveryWalFileFactory.getReader(type) with a type string that is not \"hdfs\", \"s3\", or \"oss\" (case-insensitive after toUpperCase), including null/empty strings which fail valueOf.","commonSituations":"Typo in storage type config (e.g. \"s3a\", \"hdfs2\"); config file using a lowercase scheme with extra whitespace; upgrading SeaTunnel where a formerly-supported type was removed.","solutions":["Set the storage type to one of: hdfs, s3, oss","Trim and normalize the type string before passing it (type.trim().toUpperCase())","Check the config file for typos or extra characters in the type field","Implement a custom reader and register it if a new backend is genuinely needed"],"exampleFix":"// before\nIFileReader reader = DiscoveryWalFileFactory.getReader(\"s3a\");\n// after\nIFileReader reader = DiscoveryWalFileFactory.getReader(\"s3\");","handlingStrategy":"validation","validationCode":"import static org.apache.seatunnel.engine.imap.storage.file.api.FileConfiguration.*;\nSet<String> supported = Set.of(\"HDFS\", \"S3\", \"OSS\");\nif (type == null || !supported.contains(type.trim().toUpperCase()))\n    throw new IllegalArgumentException(\"storage type must be one of \" + supported);","typeGuard":null,"tryCatchPattern":"try {\n    reader = DiscoveryWalFileFactory.getReader(type);\n} catch (UnsupportedOperationException e) {\n    LOG.error(\"Unsupported storage type: {}\", type);\n    reader = DiscoveryWalFileFactory.getReader(\"hdfs\"); // or fail fast\n}","preventionTips":["Whitelist-validate the type config key at parse time (hdfs|s3|oss)","Trim and uppercase user-provided type strings","Keep a unit test covering every enum value the factory must support"],"tags":["java","unsupported-type","factory","imap-storage"],"backgroundTag":"unsupported-enum-value","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}