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

  1. Read the error message: it names the file and the missing field (e.g. 'dbMapping.database').
  2. Open the named yml and add the missing required field(s): database (always), and table + targetTable for non-mirrorDb configs.
  3. Re-validate by restarting the adapter after the fix.
  4. 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

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


AI-assisted analysis of alibaba/canal@87be50e876 (2026-08-14). Data as JSON: /api/errors/a058789adcb5dfa6. Report an issue: GitHub.