{"record":{"id":"0af800a69de37521","repo":"apolloconfig/apollo","slug":"conflictaction-is-incorrect-0af800","errorCode":null,"errorMessage":"ConflictAction is incorrect.","messagePattern":"ConflictAction is incorrect\\.","errorType":"validation","errorClass":"BadRequestException","httpStatus":400,"severity":"warning","filePath":"apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ConfigsImportController.java","lineNumber":124,"sourceCode":"  @PreAuthorize(value = \"@unifiedPermissionValidator.isAppAdmin(#appId)\")\n  @PostMapping(value = \"/apps/{appId}/envs/{env}/clusters/{clusterName}/import\")\n  public void importAppConfigByZip(@PathVariable String appId, @PathVariable String env,\n      @PathVariable String clusterName,\n      @RequestParam(defaultValue = CONFLICT_ACTION_IGNORE) String conflictAction,\n      @RequestParam(\"file\") MultipartFile file) throws IOException {\n    validateConflictAction(conflictAction);\n    boolean ignoreConflictNamespace = conflictAction.equals(CONFLICT_ACTION_IGNORE);\n    byte[] bytes = file.getBytes();\n    try (ZipInputStream zipInputStream = new ZipInputStream(new ByteArrayInputStream(bytes))) {\n      configsImportService.importAppConfigFromZipFile(appId, Env.valueOf(env), clusterName,\n          zipInputStream, ignoreConflictNamespace, userInfoHolder.getUser().getUserId());\n    }\n  }\n\n  private void validateConflictAction(String conflictAction) {\n    if (!conflictAction.equals(CONFLICT_ACTION_COVER)\n        && !conflictAction.equals(CONFLICT_ACTION_IGNORE)) {\n      throw new BadRequestException(\"ConflictAction is incorrect.\");\n    }\n  }\n}\n","sourceCodeStart":106,"sourceCodeEnd":128,"githubUrl":"https://github.com/apolloconfig/apollo/blob/d95fc18d112589efc09ddcbe1507047584d55251/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ConfigsImportController.java#L106-L128","documentation":"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'.","triggerScenarios":"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).","commonSituations":"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.","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)."],"exampleFix":"// before\n?conflictAction=overwrite   // rejected\n\n// after\n?conflictAction=cover","handlingStrategy":"validation","validationCode":"// Allow only the two documented actions; default is 'ignore'.\nstatic final Set<String> ALLOWED = Set.of(\"cover\", \"ignore\");\nString conflictAction = requested == null ? \"ignore\" : requested;\nif (!ALLOWED.contains(conflictAction)) {\n  throw new IllegalArgumentException(\"conflictAction must be one of \" + ALLOWED);\n}","typeGuard":"static boolean isValidConflictAction(String a) {\n  return a != null && (a.equals(\"cover\") || a.equals(\"ignore\"));\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["import","validation","conflict-action","bad-request"],"backgroundTag":null,"analyzedSha":"d95fc18d112589efc09ddcbe1507047584d55251","analyzedAt":"2026-08-14T04:00:05.477Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}