{"record":{"id":"6f6398bbe58940f9","repo":"apolloconfig/apollo","slug":"current-release-equal-to-target-release","errorCode":null,"errorMessage":"current release equal to target release","messagePattern":"current release equal to target release","errorType":"exception","errorClass":"BadRequestException","httpStatus":400,"severity":"warning","filePath":"apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ReleaseService.java","lineNumber":492,"sourceCode":"    release.setAbandoned(true);\n    release.setDataChangeLastModifiedBy(operator);\n\n    releaseRepository.save(release);\n\n    releaseHistoryService.createReleaseHistory(appId, clusterName, namespaceName, clusterName,\n        twoLatestActiveReleases.get(1).getId(), release.getId(), ReleaseOperation.ROLLBACK, null,\n        operator);\n\n    // publish child namespace if namespace has child\n    rollbackChildNamespace(appId, clusterName, namespaceName, twoLatestActiveReleases, operator);\n\n    return release;\n  }\n\n  @Transactional\n  public Release rollbackTo(long releaseId, long toReleaseId, String operator) {\n    if (releaseId == toReleaseId) {\n      throw new BadRequestException(\"current release equal to target release\");\n    }\n\n    Release release = findOne(releaseId);\n    Release toRelease = findOne(toReleaseId);\n\n    if (release == null) {\n      throw NotFoundException.releaseNotFound(releaseId);\n    }\n    if (toRelease == null) {\n      throw NotFoundException.releaseNotFound(toReleaseId);\n    }\n    if (release.isAbandoned() || toRelease.isAbandoned()) {\n      throw new BadRequestException(\"release is not active\");\n    }\n\n    String appId = release.getAppId();\n    String clusterName = release.getClusterName();\n    String namespaceName = release.getNamespaceName();","sourceCodeStart":474,"sourceCodeEnd":510,"githubUrl":"https://github.com/apolloconfig/apollo/blob/d95fc18d112589efc09ddcbe1507047584d55251/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ReleaseService.java#L474-L510","documentation":"Thrown as BadRequestException (HTTP 400) by ReleaseService.rollbackTo when releaseId equals toReleaseId. Rolling a release back to itself is a no-op and is explicitly rejected.","triggerScenarios":"Calling rollbackTo(releaseId, toReleaseId) where both ids are the same value.","commonSituations":"Client logic that computes target = current by mistake; copy-paste of the same id variable; UI defaulting the target dropdown to the current release.","solutions":["Pass a distinct toReleaseId that is an earlier active release.","Guard the call site: if (releaseId == toReleaseId) skip or surface a user message instead of calling."],"exampleFix":"// before\nreleaseService.rollbackTo(id, id, operator); // 400\n// after\nif (releaseId != toReleaseId) {\n  releaseService.rollbackTo(releaseId, toReleaseId, operator);\n}","handlingStrategy":"validation","validationCode":"if (releaseId == toReleaseId) {\n  // no-op or user message; do not call rollbackTo\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Guard the call site with an equality check.","Default the target-selection dropdown to a release other than current."],"tags":["release","rollback","bad-request","apollo-biz","validation"],"backgroundTag":null,"analyzedSha":"d95fc18d112589efc09ddcbe1507047584d55251","analyzedAt":"2026-08-14T04:00:05.477Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}