apolloconfig/apollo · error · BadRequestException

ConflictAction is incorrect.

Error message

ConflictAction is incorrect.

What it means

Thrown by validateConflictAction when the conflictAction parameter is neither 'cover' nor 'ignore' (the only two allowed values). Apollo uses conflictAction to decide how to handle config conflicts during import: 'ignore' skips conflicting items, 'cover' overwrites them. If the parameter is provided but is not one of these two strings, the request is rejected. Note: an empty/null conflictAction defaults to 'ignore' and does not trigger this error.

Source

Thrown at apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/v1/controller/PortalManagementController.java:902

    public InputStream getInputStream() throws IOException {
      InputStream delegate = super.getInputStream();
      return new FilterInputStream(delegate) {
        @Override
        public void close() throws IOException {
          try {
            super.close();
          } finally {
            Files.deleteIfExists(path);
          }
        }
      };
    }
  }

  private void validateConflictAction(String conflictAction) {
    if (!CONFLICT_ACTION_COVER.equals(conflictAction)
        && !CONFLICT_ACTION_IGNORE.equals(conflictAction)) {
      throw new BadRequestException("ConflictAction is incorrect.");
    }
  }

  private String resolveConflictAction(String conflictAction) {
    if (StringUtils.isEmpty(conflictAction)) {
      return CONFLICT_ACTION_IGNORE;
    }
    validateConflictAction(conflictAction);
    return conflictAction;
  }

  private void validateServerConfig(ServerConfig serverConfig) {
    if (serverConfig == null) {
      throw new BadRequestException("ServerConfig can not be null");
    }
    if (!org.springframework.util.StringUtils.hasText(serverConfig.getKey())) {
      throw new BadRequestException("ServerConfig.Key cannot be blank");
    }

View on GitHub (pinned to d95fc18d11)

Solutions

  1. Set conflictAction to either 'cover' (overwrite conflicts) or 'ignore' (skip conflicts).
  2. Omit the conflictAction parameter entirely if you want the default 'ignore' behavior.
  3. Check Apollo's API docs for the exact accepted values.

Example fix

// before
POST /import/configs?conflictAction=overwrite

// after
POST /import/configs?conflictAction=cover
Defensive patterns

Strategy: validation

Validate before calling

// Validate conflictAction before calling import
if (conflictAction != null && !"cover".equals(conflictAction) && !"ignore".equals(conflictAction)) {
  throw new IllegalArgumentException("conflictAction must be 'cover' or 'ignore'");
}

Type guard

function isValidConflictAction(action: string | undefined): boolean {
  return action === undefined || action === null || action === 'cover' || action === 'ignore';
}

Prevention

When it happens

Trigger: An import endpoint (importAllConfigs, importAppConfig) is called with conflictAction set to a value other than 'cover' or 'ignore', such as 'overwrite', 'skip', or 'merge'.

Common situations: The caller guessed the conflict-action value name; documentation was misread; or a client used a different constant name than Apollo expects.

Related errors


AI-assisted analysis of apolloconfig/apollo@d95fc18d11 (2026-08-14). Data as JSON: /api/errors/d43c9b6a634bd56a. Report an issue: GitHub.