apolloconfig/apollo · error · BadRequestException

Public appNamespace not exists. NamespaceName = %s

Error message

Public appNamespace not exists. NamespaceName = %s

What it means

Thrown as BadRequestException (HTTP 400) by NamespaceService.findPublicAppNamespaceAllNamespaces when the supplied namespaceName is not registered as a PUBLIC AppNamespace (appNamespaceService.findPublicNamespaceByName returns null). Apollo only resolves 'all namespaces across apps' for namespaces explicitly marked public; private app namespaces cannot be queried this way.

Source

Thrown at apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/NamespaceService.java:179

    // and default cluster's namespace exist and has published.
    // return default cluster's namespace
    Release defaultNamespaceLatestActiveRelease =
        releaseService.findLatestActiveRelease(defaultNamespace);
    if (defaultNamespaceLatestActiveRelease != null) {
      return defaultNamespace;
    }

    // custom cluster's namespace exist but never published.
    // and default cluster's namespace exist but never published.
    // return custom cluster's namespace
    return namespace;
  }

  public List<Namespace> findPublicAppNamespaceAllNamespaces(String namespaceName, Pageable page) {
    AppNamespace publicAppNamespace = appNamespaceService.findPublicNamespaceByName(namespaceName);

    if (publicAppNamespace == null) {
      throw new BadRequestException(
          String.format("Public appNamespace not exists. NamespaceName = %s", namespaceName));
    }

    List<Namespace> namespaces = namespaceRepository.findByNamespaceName(namespaceName, page);

    return filterChildNamespace(namespaces);
  }

  private List<Namespace> filterChildNamespace(List<Namespace> namespaces) {
    List<Namespace> result = new LinkedList<>();

    if (CollectionUtils.isEmpty(namespaces)) {
      return result;
    }

    for (Namespace namespace : namespaces) {
      if (!isChildNamespace(namespace)) {
        result.add(namespace);

View on GitHub (pinned to d95fc18d11)

Solutions

  1. Verify the namespace is registered as public: check AppNamespace.isPublic=true for that namespaceName in the portal DB.
  2. Correct the namespace name / casing to match the registered public AppNamespace.
  3. If it must be public, convert/recreate it as a public AppNamespace before querying.

Example fix

// before
appNamespaceService.findPublicAppNamespaceAllNamespaces("myconfig", page); // not public -> 400
// after
AppNamespace an = appNamespaceService.findByAppIdAndName(appId, "myconfig");
if (an == null || !an.isPublic()) {
  // register/convert as public first, or use a private lookup instead
}
Defensive patterns

Strategy: validation

Validate before calling

AppNamespace pub = appNamespaceService.findPublicNamespaceByName(namespaceName);
if (pub == null) {
  // not public/unknown — do not call findPublicAppNamespaceAllNamespaces
}

Prevention

When it happens

Trigger: Calling findPublicAppNamespaceAllNamespaces(namespaceName, page) with a namespace name that is either misspelled, does not exist, or exists only as a private (non-public) AppNamespace.

Common situations: Listing which apps consume a shared namespace; querying a namespace that was created as private by default; typo or wrong casing in the namespace name.

Related errors


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