alibaba/canal · error · RuntimeException
ERROR Config: {} {}
Error message
ERROR Config: {} {} What it means
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.
Source
Thrown at client-adapter/clickhouse/src/main/java/com/alibaba/otter/canal/client/adapter/clickhouse/config/ConfigLoader.java:44
* 加载CLICKHOUSE表映射配置
*
* @return 配置名/配置文件名--对象
*/
public static Map<String, MappingConfig> load(Properties envProperties) {
logger.info("## Start loading clickhouse mapping config ... ");
Map<String, MappingConfig> result = new LinkedHashMap<>();
Map<String, String> configContentMap = MappingConfigsLoader.loadConfigs("clickhouse");
configContentMap.forEach((fileName, content) -> {
MappingConfig config = YamlUtils.ymlToObj(null, content, MappingConfig.class, null, envProperties);
if (config == null) {
return;
}
try {
config.validate();
} catch (Exception e) {
throw new RuntimeException("ERROR Config: " + fileName + " " + e.getMessage(), e);
}
result.put(fileName, config);
});
logger.info("## ClickHouse mapping config loaded");
return result;
}
}
View on GitHub (pinned to 87be50e876)
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).
Example fix
# before (mytable-clickhouse.yml): dbMapping: database: mydb # table and targetTable missing # after: dbMapping: database: mydb table: source_table targetTable: target_table
Defensive patterns
Strategy: try-catch
Validate before calling
// Validate the mapping offline before adapter startup.
MappingConfig config = YamlUtils.ymlToObj(null, content, MappingConfig.class, null, envProperties);
if (config != null) {
try { config.validate(); }
catch (Exception e) { logger.error("Config invalid: {}", e.getMessage()); }
} Try / catch
try {
adapter.init(config, envProperties);
} catch (RuntimeException e) {
if (e.getMessage().startsWith("ERROR Config:")) {
// message format: 'ERROR Config: <file> <reason>'
logger.error("Mapping config validation failed: {}", e.getMessage());
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- No clickhouse adapter found for config key: {}
- dbMapping.database
- dbMapping.table
- dbMapping.targetTable
- not allow to change outAdapterKey
AI-assisted analysis of alibaba/canal@87be50e876 (2026-08-14).
Data as JSON: /api/errors/a058789adcb5dfa6.
Report an issue: GitHub.