apache/dubbo · error · IllegalStateException

Duplicate Configs found for <configName>, only one unique <c

Error message

Duplicate Configs found for <configName>, only one unique <configName> is allowed for one application. previous: <oldOne>, later: <config>. According to config mode [<configMode>], please remove redundant configs and keep only one.

What it means

Thrown by AbstractConfigManager.checkUniqueConfig() in STRICT config mode when a second config of a unique type (ApplicationConfig, ModuleConfig, etc.) is added and its values differ from the existing one. The message reports both previous and later config plus the active config mode, telling the user the conflict is fatal under STRICT. In OVERRIDE/IGNORE modes the same situation is handled non-fatally.

Source

Thrown at dubbo-common/src/main/java/org/apache/dubbo/config/context/AbstractConfigManager.java:453

        list = configsMap.values().stream()
                .filter(c -> AbstractConfigManager.isDefaultConfig(c) == null)
                .collect(Collectors.toList());
        return list;

        // exclude isDefault() == false
    }

    protected <C extends AbstractConfig> Optional<C> checkUniqueConfig(Map<String, C> configsMap, C config) {
        if (configsMap.size() > 0 && isUniqueConfig(config)) {
            C oldOne = configsMap.values().iterator().next();
            String configName = oldOne.getClass().getSimpleName();
            String msgPrefix = "Duplicate Configs found for " + configName + ", only one unique " + configName
                    + " is allowed for one application. previous: " + oldOne + ", later: " + config
                    + ". According to config mode [" + configMode + "], ";
            switch (configMode) {
                case STRICT: {
                    if (!isEquals(oldOne, config)) {
                        throw new IllegalStateException(
                                msgPrefix + "please remove redundant configs and keep only one.");
                    }
                    break;
                }
                case IGNORE: {
                    // ignore later config
                    if (logger.isWarnEnabled() && duplicatedConfigs.add(config)) {
                        logger.warn(
                                COMMON_UNEXPECTED_EXCEPTION,
                                "",
                                "",
                                msgPrefix + "keep previous config and ignore later config");
                    }
                    return Optional.of(oldOne);
                }
                case OVERRIDE: {
                    // clear previous config, add new config
                    configsMap.clear();

View on GitHub (pinned to 3a3043227f)

Solutions

  1. Remove one of the conflicting configs and keep a single source of truth.
  2. Make the two configs equal if both are legitimately needed (then STRICT allows the duplicate).
  3. Set dubbo.config.mode=OVERRIDE to let the later config win, or IGNORE to keep the first (only if intended).

Example fix

# before (STRICT mode, conflicting app configs)
dubbo.application.name=appA
dubbo.application.name=appB
# after (single source)
dubbo.application.name=appA
# or relax mode
dubbo.config.mode=OVERRIDE
Defensive patterns

Strategy: validation

Validate before calling

// Detect unique-config duplication before it throws
AbstractConfig existing = configManager.getSingleConfig("application");
if (existing != null && !isEquals(existing, newAppConfig)) {
    throw new IllegalStateException("Conflicting application configs under STRICT mode");
}
configManager.addConfig(newAppConfig);

Type guard

static boolean wouldConflictUnique(ConfigManager cm, AbstractConfig newCfg) {
    AbstractConfig existing = cm.getSingleConfig(newCfg.getTagName());
    return existing != null && !existing.equals(newCfg);
}

Try / catch

try {
    configManager.addConfig(appConfig);
} catch (IllegalStateException e) {
    if (e.getMessage().contains("Duplicate Configs found")) {
        // remove the redundant config or set dubbo.config.mode=OVERRIDE
    } else throw e;
}

Prevention

When it happens

Trigger: Adding a second ApplicationConfig (or other unique type) with different attribute values while dubbo.config.mode=STRICT. Programmatically calling addConfig twice for a unique type with non-equal contents.

Common situations: Spring Boot auto-configuration creating an ApplicationConfig and application code also defining one with different attributes. Multi-module setups where each module declares its own application config. Default STRICT mode surfacing conflicts that OVERRIDE mode would silently resolve.

Related errors


AI-assisted analysis of apache/dubbo@3a3043227f (2026-08-14). Data as JSON: /api/errors/730d8e9d3d83b7e2. Report an issue: GitHub.