{"record":{"id":"b88e74acefc4f148","repo":"apache/seatunnel","slug":"seatunnelapierrorcode-config-validation-failed-b88e74","errorCode":"SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED","errorMessage":"PluginName: %s, PluginType: %s, Message: %s","messagePattern":"PluginName: (.+?), PluginType: (.+?), Message: (.+?)","errorType":"error_code","errorClass":"FileConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-file/connector-file-hadoop/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/hdfs/config/HdfsFileHadoopConfig.java","lineNumber":43,"sourceCode":"import org.apache.seatunnel.connectors.seatunnel.file.config.FileBaseSourceOptions;\nimport org.apache.seatunnel.connectors.seatunnel.file.config.FileSystemType;\nimport org.apache.seatunnel.connectors.seatunnel.file.config.HadoopConf;\nimport org.apache.seatunnel.connectors.seatunnel.file.exception.FileConnectorException;\n\npublic class HdfsFileHadoopConfig extends HadoopConf {\n    public HdfsFileHadoopConfig(String hdfsNameKey) {\n        super(hdfsNameKey);\n    }\n\n    public static HadoopConf buildWithConfig(ReadonlyConfig readonlyConfig) {\n        CheckResult result =\n                CheckConfigUtil.checkAllExists(\n                        readonlyConfig.toConfig(),\n                        FileBaseSourceOptions.FILE_PATH.key(),\n                        FileBaseSourceOptions.FILE_FORMAT_TYPE.key(),\n                        FileBaseSourceOptions.DEFAULT_FS.key());\n        if (!result.isSuccess()) {\n            throw new FileConnectorException(\n                    SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,\n                    String.format(\n                            \"PluginName: %s, PluginType: %s, Message: %s\",\n                            FileSystemType.HDFS.getFileSystemPluginName(),\n                            PluginType.SOURCE,\n                            result.getMsg()));\n        }\n        HadoopConf hadoopConf =\n                new HdfsFileHadoopConfig(readonlyConfig.get(FileBaseSourceOptions.DEFAULT_FS));\n\n        if (readonlyConfig.getOptional(FileBaseSourceOptions.HDFS_SITE_PATH).isPresent()) {\n            hadoopConf.setHdfsSitePath(readonlyConfig.get(FileBaseSourceOptions.HDFS_SITE_PATH));\n        }\n\n        if (readonlyConfig.getOptional(FileBaseSourceOptions.REMOTE_USER).isPresent()) {\n            hadoopConf.setRemoteUser(readonlyConfig.get(FileBaseSourceOptions.REMOTE_USER));\n        }\n","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-file/connector-file-hadoop/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/hdfs/config/HdfsFileHadoopConfig.java#L25-L61","documentation":"HdfsFileHadoopConfig.buildWithConfig validates that the three mandatory HDFS source options are present — FILE_PATH, FILE_FORMAT_TYPE, and DEFAULT_FS — using CheckConfigUtil.checkAllExists. If any is missing it throws FileConnectorException with error code CONFIG_VALIDATION_FAILED and a message naming the HDFS plugin, plugin type SOURCE, and the aggregated validation message.","triggerScenarios":"buildWithConfig invoked for an HDFS file source whose readonlyConfig lacks any of: FILE_PATH (file_path), FILE_FORMAT_TYPE (file_format_type), or DEFAULT_FS (fs.defaultFS) keys.","commonSituations":"User omitted file_format_type or fs.defaultFS in the HDFS source config block; typo in option keys (e.g. 'file_format' instead of 'file_format_type'); copied a local-file example that doesn't require default_fs and reused it for HDFS; config section nested under the wrong plugin so keys aren't found.","solutions":["Add all required options to the source config: file_path, file_format_type, and fs.defaultFS (e.g. \"hdfs://namenode:8020\")","Read result.getMsg() in the error message to see exactly which key(s) are missing","Fix any misspelled option keys to match FileBaseSourceOptions definitions","Verify the options are inside the correct source/sink plugin block so they appear in readonlyConfig"],"exampleFix":"// before\nHdfsFile {\n    file_path = \"/data/input\"\n}\n// after\nHdfsFile {\n    file_path = \"/data/input\"\n    file_format_type = \"json\"\n    fs.defaultFS = \"hdfs://namenode:8020\"\n}","handlingStrategy":"validation","validationCode":"// Java: validate required HDFS options before building config\nConfig cfg = readonlyConfig.toConfig();\njava.util.List<String> missing = new java.util.ArrayList<>();\nfor (String key : new String[]{\"file_path\", \"file_format_type\", \"fs.defaultFS\"}) {\n    if (!cfg.hasPath(key)) missing.add(key);\n}\nif (!missing.isEmpty()) {\n    throw new IllegalArgumentException(\"Missing required HDFS options: \" + missing);\n}","typeGuard":null,"tryCatchPattern":"try {\n    HdfsFileHadoopConfig.buildWithConfig(readonlyConfig);\n} catch (FileConnectorException e) {\n    if (e.getCode() == SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED) {\n        logger.error(\"HDFS source config incomplete — see message for missing keys: {}\", e.getMessage());\n    }\n    throw e;\n}","preventionTips":["Always include file_path, file_format_type, and fs.defaultFS in HDFS source configs","Copy option keys exactly from FileBaseSourceOptions (no typos)","Use a config linter/schema check on job configs before submission","Don't reuse local-file examples for HDFS (default_fs is required)"],"tags":["hdfs","config","validation"],"backgroundTag":"missing-required-config-field","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}