apolloconfig/apollo · warning · BadRequestException
ConflictAction is incorrect.
Error message
ConflictAction is incorrect.
What it means
BadRequestException (HTTP 400) from ConfigsImportController.validateConflictAction. The import endpoints accept only the literals 'cover' or 'ignore' (case-sensitive) for the conflictAction request parameter; anything else is rejected before the zip is opened. The default value when omitted is 'ignore'.
Source
Thrown at apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ConfigsImportController.java:124
@PreAuthorize(value = "@unifiedPermissionValidator.isAppAdmin(#appId)")
@PostMapping(value = "/apps/{appId}/envs/{env}/clusters/{clusterName}/import")
public void importAppConfigByZip(@PathVariable String appId, @PathVariable String env,
@PathVariable String clusterName,
@RequestParam(defaultValue = CONFLICT_ACTION_IGNORE) String conflictAction,
@RequestParam("file") MultipartFile file) throws IOException {
validateConflictAction(conflictAction);
boolean ignoreConflictNamespace = conflictAction.equals(CONFLICT_ACTION_IGNORE);
byte[] bytes = file.getBytes();
try (ZipInputStream zipInputStream = new ZipInputStream(new ByteArrayInputStream(bytes))) {
configsImportService.importAppConfigFromZipFile(appId, Env.valueOf(env), clusterName,
zipInputStream, ignoreConflictNamespace, userInfoHolder.getUser().getUserId());
}
}
private void validateConflictAction(String conflictAction) {
if (!conflictAction.equals(CONFLICT_ACTION_COVER)
&& !conflictAction.equals(CONFLICT_ACTION_IGNORE)) {
throw new BadRequestException("ConflictAction is incorrect.");
}
}
}
View on GitHub (pinned to d95fc18d11)
Solutions
- Send conflictAction='cover' to overwrite or 'ignore' to skip existing namespaces.
- Match case exactly (lowercase) or normalize client-side before sending.
- If unsure, omit the parameter to get the documented default ('ignore').
- Validate the value against {cover, ignore} before the call (see validationCode).
Example fix
// before ?conflictAction=overwrite // rejected // after ?conflictAction=cover
Defensive patterns
Strategy: validation
Validate before calling
// Allow only the two documented actions; default is 'ignore'.
static final Set<String> ALLOWED = Set.of("cover", "ignore");
String conflictAction = requested == null ? "ignore" : requested;
if (!ALLOWED.contains(conflictAction)) {
throw new IllegalArgumentException("conflictAction must be one of " + ALLOWED);
} Type guard
static boolean isValidConflictAction(String a) {
return a != null && (a.equals("cover") || a.equals("ignore"));
} Prevention
- Use exactly 'cover' or 'ignore' (lowercase, case-sensitive).
- Omit the param to get the safe default 'ignore'.
- Add an enum on the client side instead of free-text.
- Reject unknown values client-side with the type guard.
When it happens
Trigger: POST /apps/{appId}/envs/{env}/clusters/{clusterName}/importItems or .../importCluster with conflictAction not equal to 'cover' or 'ignore' (e.g. 'overwrite', 'skip', 'Cover', empty handled by default).
Common situations: Typos ('overwrite' instead of 'cover'); wrong case ('Cover'); sending a value copied from another tool's API; an older client using a removed action name.
Related errors
- ConflictAction is incorrect.
- The App Id of path variable and request body is different
- Comment item's key or value should be blank.
- Comment item's comment should not be blank.
- value too long. length limit:%s
AI-assisted analysis of apolloconfig/apollo@d95fc18d11 (2026-08-14).
Data as JSON: /api/errors/0af800a69de37521.
Report an issue: GitHub.