apolloconfig/apollo · warning · BadRequestException

current release equal to target release

Error message

current release equal to target release

What it means

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.

Source

Thrown at apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ReleaseService.java:492

    release.setAbandoned(true);
    release.setDataChangeLastModifiedBy(operator);

    releaseRepository.save(release);

    releaseHistoryService.createReleaseHistory(appId, clusterName, namespaceName, clusterName,
        twoLatestActiveReleases.get(1).getId(), release.getId(), ReleaseOperation.ROLLBACK, null,
        operator);

    // publish child namespace if namespace has child
    rollbackChildNamespace(appId, clusterName, namespaceName, twoLatestActiveReleases, operator);

    return release;
  }

  @Transactional
  public Release rollbackTo(long releaseId, long toReleaseId, String operator) {
    if (releaseId == toReleaseId) {
      throw new BadRequestException("current release equal to target release");
    }

    Release release = findOne(releaseId);
    Release toRelease = findOne(toReleaseId);

    if (release == null) {
      throw NotFoundException.releaseNotFound(releaseId);
    }
    if (toRelease == null) {
      throw NotFoundException.releaseNotFound(toReleaseId);
    }
    if (release.isAbandoned() || toRelease.isAbandoned()) {
      throw new BadRequestException("release is not active");
    }

    String appId = release.getAppId();
    String clusterName = release.getClusterName();
    String namespaceName = release.getNamespaceName();

View on GitHub (pinned to d95fc18d11)

Solutions

  1. Pass a distinct toReleaseId that is an earlier active release.
  2. Guard the call site: if (releaseId == toReleaseId) skip or surface a user message instead of calling.

Example fix

// before
releaseService.rollbackTo(id, id, operator); // 400
// after
if (releaseId != toReleaseId) {
  releaseService.rollbackTo(releaseId, toReleaseId, operator);
}
Defensive patterns

Strategy: validation

Validate before calling

if (releaseId == toReleaseId) {
  // no-op or user message; do not call rollbackTo
}

Prevention

When it happens

Trigger: Calling rollbackTo(releaseId, toReleaseId) where both ids are the same value.

Common situations: Client logic that computes target = current by mistake; copy-paste of the same id variable; UI defaulting the target dropdown to the current release.

Related errors


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