{"record":{"id":"d43c9b6a634bd56a","repo":"apolloconfig/apollo","slug":"conflictaction-is-incorrect","errorCode":null,"errorMessage":"ConflictAction is incorrect.","messagePattern":"ConflictAction is incorrect\\.","errorType":"validation","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/v1/controller/PortalManagementController.java","lineNumber":902,"sourceCode":"    public InputStream getInputStream() throws IOException {\n      InputStream delegate = super.getInputStream();\n      return new FilterInputStream(delegate) {\n        @Override\n        public void close() throws IOException {\n          try {\n            super.close();\n          } finally {\n            Files.deleteIfExists(path);\n          }\n        }\n      };\n    }\n  }\n\n  private void validateConflictAction(String conflictAction) {\n    if (!CONFLICT_ACTION_COVER.equals(conflictAction)\n        && !CONFLICT_ACTION_IGNORE.equals(conflictAction)) {\n      throw new BadRequestException(\"ConflictAction is incorrect.\");\n    }\n  }\n\n  private String resolveConflictAction(String conflictAction) {\n    if (StringUtils.isEmpty(conflictAction)) {\n      return CONFLICT_ACTION_IGNORE;\n    }\n    validateConflictAction(conflictAction);\n    return conflictAction;\n  }\n\n  private void validateServerConfig(ServerConfig serverConfig) {\n    if (serverConfig == null) {\n      throw new BadRequestException(\"ServerConfig can not be null\");\n    }\n    if (!org.springframework.util.StringUtils.hasText(serverConfig.getKey())) {\n      throw new BadRequestException(\"ServerConfig.Key cannot be blank\");\n    }","sourceCodeStart":884,"sourceCodeEnd":920,"githubUrl":"https://github.com/apolloconfig/apollo/blob/d95fc18d112589efc09ddcbe1507047584d55251/apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/v1/controller/PortalManagementController.java#L884-L920","documentation":"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.","triggerScenarios":"An import endpoint (importAllConfigs, importAppConfig) is called with conflictAction set to a value other than 'cover' or 'ignore', such as 'overwrite', 'skip', or 'merge'.","commonSituations":"The caller guessed the conflict-action value name; documentation was misread; or a client used a different constant name than Apollo expects.","solutions":["Set conflictAction to either 'cover' (overwrite conflicts) or 'ignore' (skip conflicts).","Omit the conflictAction parameter entirely if you want the default 'ignore' behavior.","Check Apollo's API docs for the exact accepted values."],"exampleFix":"// before\nPOST /import/configs?conflictAction=overwrite\n\n// after\nPOST /import/configs?conflictAction=cover","handlingStrategy":"validation","validationCode":"// Validate conflictAction before calling import\nif (conflictAction != null && !\"cover\".equals(conflictAction) && !\"ignore\".equals(conflictAction)) {\n  throw new IllegalArgumentException(\"conflictAction must be 'cover' or 'ignore'\");\n}","typeGuard":"function isValidConflictAction(action: string | undefined): boolean {\n  return action === undefined || action === null || action === 'cover' || action === 'ignore';\n}","tryCatchPattern":null,"preventionTips":["Use an enum or constant set for conflictAction values in client code.","Omit the parameter when default 'ignore' behavior is acceptable.","Document the two valid values prominently in client integration guides."],"tags":["validation","openapi","bad-request","import","conflict-action","apollo-portal"],"backgroundTag":null,"analyzedSha":"d95fc18d112589efc09ddcbe1507047584d55251","analyzedAt":"2026-08-14T04:00:05.477Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}