apolloconfig/apollo · error · NotFoundException

Parent namespace not found

Error message

Parent namespace not found

What it means

Thrown as NotFoundException (HTTP 404) by ReleaseService.publish when findParentNamespace returns null for the namespace being published. This publish path is for branch (gray) releases that must reference a master/parent namespace; reaching the throw means the branch was published with no resolvable parent.

Source

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

  }

  @Transactional
  public Release grayDeletionPublish(Namespace namespace, String releaseName, String releaseComment,
      String operator, boolean isEmergencyPublish, Set<String> grayDelKeys) {

    checkLock(namespace, isEmergencyPublish, operator);

    Map<String, String> operateNamespaceItems = getNamespaceItems(namespace);

    Namespace parentNamespace = namespaceService.findParentNamespace(namespace);

    // branch release
    if (parentNamespace != null) {
      return publishBranchNamespace(parentNamespace, namespace, operateNamespaceItems, releaseName,
          releaseComment, operator, isEmergencyPublish, grayDelKeys);
    }
    throw new NotFoundException("Parent namespace not found");
  }

  private void checkLock(Namespace namespace, boolean isEmergencyPublish, String operator) {
    if (!isEmergencyPublish) {
      NamespaceLock lock = namespaceLockService.findLock(namespace.getId());
      if (lock != null && lock.getDataChangeCreatedBy().equals(operator)) {
        throw new BadRequestException("Config can not be published by yourself.");
      }
    }
  }

  private void mergeFromMasterAndPublishBranch(Namespace parentNamespace, Namespace childNamespace,
      Map<String, String> parentNamespaceItems, String releaseName, String releaseComment,
      String operator, Release masterPreviousRelease, Release parentRelease,
      boolean isEmergencyPublish) {
    // create release for child namespace
    Release childNamespaceLatestActiveRelease = findLatestActiveRelease(childNamespace);

View on GitHub (pinned to d95fc18d11)

Solutions

  1. Confirm the parent/master namespace exists for the same appId and namespaceName (typically default cluster).
  2. Recreate or restore the master namespace before publishing the branch.
  3. If the branch is orphaned intentionally, publish from the master instead or delete the branch.
Defensive patterns

Strategy: validation

Validate before calling

Namespace parent = namespaceService.findParentNamespace(namespace);
if (parent == null) {
  // branch has no master — do not call branch publish; fix/recreate master first
}

Try / catch

try {
  releaseService.publish(...);
} catch (NotFoundException e) {
  if ("Parent namespace not found".equals(e.getMessage())) {
    // recreate/restore master, then retry
  } else throw e;
}

Prevention

When it happens

Trigger: Publishing a branch/gray namespace whose parent master namespace does not exist (deleted, never created, or appId/clusterName mismatch resolving the parent).

Common situations: Publishing a gray release after the master namespace was removed; branch cluster misconfiguration; orphaned branch left after a parent deletion.

Related errors


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