{"record":{"id":"a058789adcb5dfa6","repo":"alibaba/canal","slug":"error-config","errorCode":null,"errorMessage":"ERROR Config: {} {}","messagePattern":"ERROR Config: (.+?) (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"client-adapter/clickhouse/src/main/java/com/alibaba/otter/canal/client/adapter/clickhouse/config/ConfigLoader.java","lineNumber":44,"sourceCode":"     * 加载CLICKHOUSE表映射配置\n     *\n     * @return 配置名/配置文件名--对象\n     */\n    public static Map<String, MappingConfig> load(Properties envProperties) {\n        logger.info(\"## Start loading clickhouse mapping config ... \");\n\n        Map<String, MappingConfig> result = new LinkedHashMap<>();\n\n        Map<String, String> configContentMap = MappingConfigsLoader.loadConfigs(\"clickhouse\");\n        configContentMap.forEach((fileName, content) -> {\n            MappingConfig config = YamlUtils.ymlToObj(null, content, MappingConfig.class, null, envProperties);\n            if (config == null) {\n                return;\n            }\n            try {\n                config.validate();\n            } catch (Exception e) {\n                throw new RuntimeException(\"ERROR Config: \" + fileName + \" \" + e.getMessage(), e);\n            }\n            result.put(fileName, config);\n        });\n\n        logger.info(\"## ClickHouse mapping config loaded\");\n        return result;\n    }\n}\n","sourceCodeStart":26,"sourceCodeEnd":53,"githubUrl":"https://github.com/alibaba/canal/blob/87be50e87686a3e8af08c368d0e1ffd1f59eb04a/client-adapter/clickhouse/src/main/java/com/alibaba/otter/canal/client/adapter/clickhouse/config/ConfigLoader.java#L26-L53","documentation":"Thrown by ConfigLoader.load when a parsed clickhouse mapping config fails MappingConfig.validate(). The RuntimeException wraps the underlying validation exception and prefixes it with the offending file name and its message, so the error identifies which yml is broken and why. It propagates up through ClickHouseAdapter.init, aborting adapter startup.","triggerScenarios":"A clickhouse mapping yml that parses but is missing required fields (database, table, targetTable for non-mirrorDb configs); a mirrorDb config missing database; validate() throwing NullPointerException on a required field.","commonSituations":"Newly added mapping file missing the database/table/targetTable keys; partial config from a template that was not fully filled; a field typo causing YAML to bind null; switching a config to/from mirrorDb mode without adjusting required fields.","solutions":["Read the error message: it names the file and the missing field (e.g. 'dbMapping.database').","Open the named yml and add the missing required field(s): database (always), and table + targetTable for non-mirrorDb configs.","Re-validate by restarting the adapter after the fix.","If using mirrorDb, set mirrorDb: true and ensure database is present (table/targetTable not required)."],"exampleFix":"# before (mytable-clickhouse.yml):\ndbMapping:\n  database: mydb\n  # table and targetTable missing\n# after:\ndbMapping:\n  database: mydb\n  table: source_table\n  targetTable: target_table","handlingStrategy":"try-catch","validationCode":"// Validate the mapping offline before adapter startup.\nMappingConfig config = YamlUtils.ymlToObj(null, content, MappingConfig.class, null, envProperties);\nif (config != null) {\n    try { config.validate(); }\n    catch (Exception e) { logger.error(\"Config invalid: {}\", e.getMessage()); }\n}","typeGuard":null,"tryCatchPattern":"try {\n    adapter.init(config, envProperties);\n} catch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"ERROR Config:\")) {\n        // message format: 'ERROR Config: <file> <reason>'\n        logger.error(\"Mapping config validation failed: {}\", e.getMessage());\n    }\n    throw e;\n}","preventionTips":["Run MappingConfig.validate() in a config-lint step during CI/deploy.","Use a complete template (database, table, targetTable) for new mapping files.","For mirrorDb configs set mirrorDb:true so table/targetTable are not required.","Keep YAML indentation consistent; validate with a YAML linter."],"tags":["clickhouse-adapter","canal-adapter","config","validation","startup"],"backgroundTag":null,"analyzedSha":"87be50e87686a3e8af08c368d0e1ffd1f59eb04a","analyzedAt":"2026-08-14T04:30:11.918Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}