alibaba/canal · error · RuntimeException

ERROR Config: {fileName} {errorMessage}

Error message

ERROR Config: {fileName} {errorMessage}

What it means

Thrown by ConfigLoader.load() during tablestore mapping config parsing when config.validate() throws for any individual YAML file. The error wraps the original validation exception's message and includes the config file name so you can identify which file failed. This is a fail-fast guard: if any single config file is invalid, the entire load aborts.

Source

Thrown at client-adapter/tablestore/src/main/java/com/alibaba/otter/canal/client/adapter/tablestore/config/ConfigLoader.java:42

     * 加载RDB表映射配置
     *
     * @return 配置名/配置文件名--对象
     */
    public static Map<String, MappingConfig> load(Properties envProperties) {
        logger.info("## Start loading tablestore mapping config ... ");

        Map<String, MappingConfig> result = new LinkedHashMap<>();

        Map<String, String> configContentMap = MappingConfigsLoader.loadConfigs("tablestore");
        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(
            "## Tablestore mapping config loaded:" + StringUtils.collectionToCommaDelimitedString(result.keySet()));
        return result;
    }
}

View on GitHub (pinned to 87be50e876)

Solutions

  1. Read the errorMessage in the exception — it identifies which specific field (e.g. 'dbMapping.database') is null or empty.
  2. Open the named fileName and verify the dbMapping block has non-empty database, table, and targetTable values.
  3. Validate YAML syntax and indentation — misaligned YAML can cause nested fields to be silently skipped.
  4. Remove or fix incomplete config files before deploying to avoid blocking all tablestore configs.

Example fix

// before: incomplete dbMapping in YAML
destination: example
dbMapping:
  database: mydb
  # table and targetTable missing

// after
destination: example
dbMapping:
  database: mydb
  table: source_table
  targetTable: ots_target_table
Defensive patterns

Strategy: validation

Validate before calling

// Validate the config before passing it to ConfigLoader
MappingConfig config = YamlUtils.ymlToObj(null, content, MappingConfig.class, null, envProperties);
if (config != null) {
    try {
        config.validate();
    } catch (NullPointerException e) {
        throw new IllegalArgumentException("Config file " + fileName + " is invalid: " + e.getMessage(), e);
    }
}

Type guard

null

Try / catch

try {
    Map<String, MappingConfig> configs = ConfigLoader.load(envProperties);
} catch (RuntimeException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("ERROR Config:")) {
        logger.error("Invalid tablestore mapping config file: {}", e.getMessage());
    }
    throw e;
}

Prevention

When it happens

Trigger: Loading tablestore configs where one YAML file fails MappingConfig.validate() — typically because dbMapping.database, dbMapping.table, or dbMapping.targetTable is null or empty. Also possible if the YAML is malformed in a way that YamlUtils.ymlToObj parses but leaves required fields unset.

Common situations: A YAML file is missing the dbMapping section entirely; dbMapping exists but database/table/targetTable sub-keys are blank; YAML indentation errors cause dbMapping fields to be parsed as top-level; an incomplete or templated config file was deployed.

Related errors


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