{"record":{"id":"c78e784e7e6b52f7","repo":"alibaba/DataX","slug":"config-error","errorCode":"CONFIG_ERROR","errorMessage":"Check config exception: %s","messagePattern":"Check config exception: (.+?)","errorType":"exception","errorClass":"Adb4pgClientException","httpStatus":null,"severity":"error","filePath":"adbpgwriter/src/main/java/com/alibaba/datax/plugin/writer/adbpgwriter/util/Adb4pgUtil.java","lineNumber":39,"sourceCode":"import java.util.*;\n\nimport static com.alibaba.datax.plugin.rdbms.util.DBUtilErrorCode.COLUMN_SPLIT_ERROR;\n\n/**\n * @author yuncheng\n */\npublic class Adb4pgUtil {\n\n    private static final Logger LOG = LoggerFactory.getLogger(Adb4pgUtil.class);\n    private static final DataBaseType DATABASE_TYPE = DataBaseType.PostgreSQL;\n    public static void checkConfig(Configuration originalConfig) {\n        try {\n\n            DatabaseConfig databaseConfig = convertConfiguration(originalConfig);\n\n            Adb4pgClient testConfigClient = new Adb4pgClient(databaseConfig);\n        } catch (Exception e) {\n            throw new Adb4pgClientException(Adb4pgClientException.CONFIG_ERROR, \"Check config exception: \" + e.getMessage(), null);\n        }\n    }\n\n    public static DatabaseConfig convertConfiguration(Configuration originalConfig) {\n        originalConfig.getNecessaryValue(Key.USERNAME, COLUMN_SPLIT_ERROR);\n        originalConfig.getNecessaryValue(Key.PASSWORD, COLUMN_SPLIT_ERROR);\n\n\n        String userName = originalConfig.getString(Key.USERNAME);\n        String passWord = originalConfig.getString(Key.PASSWORD);\n        String tableName = originalConfig.getString(Key.TABLE);\n        String schemaName = originalConfig.getString(com.alibaba.datax.plugin.writer.adbpgwriter.util.Key.SCHEMA);\n        String host = originalConfig.getString(com.alibaba.datax.plugin.writer.adbpgwriter.util.Key.HOST);\n        String port = originalConfig.getString(com.alibaba.datax.plugin.writer.adbpgwriter.util.Key.PORT);\n        String databseName = originalConfig.getString(com.alibaba.datax.plugin.writer.adbpgwriter.util.Key.DATABASE);\n\n        List<String> columns = originalConfig.getList(Key.COLUMN, String.class);\n        DatabaseConfig databaseConfig = new DatabaseConfig();","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/alibaba/DataX/blob/80ec23d5c5328eb90ca364d2749e92dfaf44541e/adbpgwriter/src/main/java/com/alibaba/datax/plugin/writer/adbpgwriter/util/Adb4pgUtil.java#L21-L57","documentation":"Thrown by Adb4pgUtil.checkConfig when the AnalyticDB for PostgreSQL writer's job configuration is invalid. checkConfig runs convertConfiguration (which enforces required keys like username/password via getNecessaryValue) and constructs an Adb4pgClient from the derived DatabaseConfig; any failure in that chain is rethrown as Adb4pgClientException with code CONFIG_ERROR. The original cause's message is appended after 'Check config exception: '.","triggerScenarios":"Calling checkConfig(originalConfig) when: username or password keys are missing (getNecessaryValue throws), required connection fields (host/port/database/table/schema) are absent or malformed so DatabaseConfig construction fails, or Adb4pgClient constructor rejects the config (e.g. blank host, unparseable port).","commonSituations":"A DataX job JSON for adbpgwriter with a typo'd key ('user' instead of 'username'), omitted jdbcUrl/username/password blocks, wrong nesting of the connection config, or extra whitespace/empty-string values that pass presence checks but fail client construction.","solutions":["Open the job JSON and confirm the writer.parameter block contains non-empty username and password keys exactly as the plugin expects (Key.USERNAME / Key.PASSWORD).","Verify remaining required fields (host, port, database, table, schema, column list) are present and correctly spelled in the same block.","Run checkConfig in isolation with your Configuration object and print e.getMessage() to see which nested key/constraint failed.","If the message still lacks detail, temporarily catch inside convertConfiguration's getNecessaryValue calls to identify the exact missing key name."],"exampleFix":"// before (job json)\n{\"writer\": {\"name\": \"adbpgwriter\", \"parameter\": {\"username\": \"u\"}}\n// after\n{\"writer\": {\"name\": \"adbpgwriter\", \"parameter\": {\"username\": \"u\", \"password\": \"p\", \"host\": \"gp-xxxx.gpdb.rds.aliyuncs.com\", \"port\": 3432, \"database\": \"db\", \"table\": [\"t\"], \"schema\": \"public\", \"column\": [\"*\"]}}","handlingStrategy":"try-catch","validationCode":"boolean requiredKeysPresent(Configuration c) {\n    for (String k : new String[]{\"username\", \"password\", \"host\", \"port\", \"database\", \"table\", \"schema\", \"column\"}) {\n        if (c.getString(k) == null && c.getList(k) == null) return false;\n    }\n    return true;\n}","typeGuard":null,"tryCatchPattern":"try {\n    Adb4pgUtil.checkConfig(originalConfig);\n} catch (Adb4pgClientException e) {\n    if (e.getCode() == Adb4pgClientException.CONFIG_ERROR) {\n        throw new IllegalStateException(\"adbpgwriter config invalid: \" + e.getMessage(), e);\n    }\n    throw e;\n}","preventionTips":["Keep a minimal working adbpgwriter job JSON as a template and diff new jobs against it.","Validate the writer parameter block in a pre-flight step before scheduling the DataX job.","Never rely on DataX's partial defaults - always set username, password, and connection fields explicitly."],"tags":["config","adbpgwriter","validation","datax"],"backgroundTag":null,"analyzedSha":"80ec23d5c5328eb90ca364d2749e92dfaf44541e","analyzedAt":"2026-08-14T15:33:51.187Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}