{"record":{"id":"8bade49d30c7ff2d","repo":"apolloconfig/apollo","slug":"parent-namespace-not-found","errorCode":null,"errorMessage":"Parent namespace not found","messagePattern":"Parent namespace not found","errorType":"exception","errorClass":"NotFoundException","httpStatus":404,"severity":"error","filePath":"apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ReleaseService.java","lineNumber":272,"sourceCode":"\n  }\n\n  @Transactional\n  public Release grayDeletionPublish(Namespace namespace, String releaseName, String releaseComment,\n      String operator, boolean isEmergencyPublish, Set<String> grayDelKeys) {\n\n    checkLock(namespace, isEmergencyPublish, operator);\n\n    Map<String, String> operateNamespaceItems = getNamespaceItems(namespace);\n\n    Namespace parentNamespace = namespaceService.findParentNamespace(namespace);\n\n    // branch release\n    if (parentNamespace != null) {\n      return publishBranchNamespace(parentNamespace, namespace, operateNamespaceItems, releaseName,\n          releaseComment, operator, isEmergencyPublish, grayDelKeys);\n    }\n    throw new NotFoundException(\"Parent namespace not found\");\n  }\n\n  private void checkLock(Namespace namespace, boolean isEmergencyPublish, String operator) {\n    if (!isEmergencyPublish) {\n      NamespaceLock lock = namespaceLockService.findLock(namespace.getId());\n      if (lock != null && lock.getDataChangeCreatedBy().equals(operator)) {\n        throw new BadRequestException(\"Config can not be published by yourself.\");\n      }\n    }\n  }\n\n  private void mergeFromMasterAndPublishBranch(Namespace parentNamespace, Namespace childNamespace,\n      Map<String, String> parentNamespaceItems, String releaseName, String releaseComment,\n      String operator, Release masterPreviousRelease, Release parentRelease,\n      boolean isEmergencyPublish) {\n    // create release for child namespace\n    Release childNamespaceLatestActiveRelease = findLatestActiveRelease(childNamespace);\n","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/apolloconfig/apollo/blob/d95fc18d112589efc09ddcbe1507047584d55251/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ReleaseService.java#L254-L290","documentation":"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.","triggerScenarios":"Publishing a branch/gray namespace whose parent master namespace does not exist (deleted, never created, or appId/clusterName mismatch resolving the parent).","commonSituations":"Publishing a gray release after the master namespace was removed; branch cluster misconfiguration; orphaned branch left after a parent deletion.","solutions":["Confirm the parent/master namespace exists for the same appId and namespaceName (typically default cluster).","Recreate or restore the master namespace before publishing the branch.","If the branch is orphaned intentionally, publish from the master instead or delete the branch."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"Namespace parent = namespaceService.findParentNamespace(namespace);\nif (parent == null) {\n  // branch has no master — do not call branch publish; fix/recreate master first\n}","typeGuard":null,"tryCatchPattern":"try {\n  releaseService.publish(...);\n} catch (NotFoundException e) {\n  if (\"Parent namespace not found\".equals(e.getMessage())) {\n    // recreate/restore master, then retry\n  } else throw e;\n}","preventionTips":["Before publishing a branch, assert the master namespace resolves.","Detect and clean up orphaned branches when a master namespace is deleted."],"tags":["release","publish","branch","not-found","apollo-biz"],"backgroundTag":null,"analyzedSha":"d95fc18d112589efc09ddcbe1507047584d55251","analyzedAt":"2026-08-14T04:00:05.477Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}