apolloconfig/apollo · warning · BadRequestException

App not found: {}

Error message

App not found: {}

What it means

Thrown by ConfigsExportService.exportAppConfigByEnvAndCluster when appService.load(appId) returns null — the appId is unknown to the portal. BadRequestException → HTTP 400. The {} is the appId. This precedes the cluster lookup, so a null app short-circuits before env/cluster validation.

Source

Thrown at apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ConfigsExportService.java:117

    exportApps(exportEnvs, outputStream);
  }

  /**
   * Export all configurations of an application in a specified environment and cluster
   * <p>
   * File Struts:
   * <p>
   *
   * List<App> -> List<Env> -> List<Namespace>
   *
   * @param outputStream network file download stream to user
   */
  public void exportAppConfigByEnvAndCluster(String appId, Env env, String clusterName,
      OutputStream outputStream) {
    App app = appService.load(appId);
    if (app == null) {
      throw new BadRequestException("App not found: " + appId);
    }
    ClusterDTO cluster = clusterService.loadCluster(appId, env, clusterName);
    if (cluster == null) {
      throw new BadRequestException(
          "The app does not exist in the specified environment and cluster.");
    }

    try (final ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream)) {
      try {
        this.exportNamespaces(env, app, cluster, zipOutputStream, true);
      } catch (BadRequestException badRequestException) {
        // ignore
      } catch (Exception e) {
        logger.error("export namespace error. appId = {}, env = {}, cluster = {}", app.getAppId(),
            env.getName(), cluster.getName(), e);
      }
    } catch (IOException e) {
      logger.error("export app config error", e);

View on GitHub (pinned to d95fc18d11)

Solutions

  1. Verify appService.load(appId) != null (or app exists in the portal UI) before exporting.
  2. Correct the appId or target the portal that owns the app.
  3. Restore the app record if it was deleted in error.

Example fix

// before
configsExportService.exportAppConfigByEnvAndCluster(appId, env, cluster, out);

// after
if (appService.load(appId) == null) {
  throw new IllegalArgumentException("appId " + appId + " not found in this portal");
}
configsExportService.exportAppConfigByEnvAndCluster(appId, env, cluster, out);
Defensive patterns

Strategy: validation

Validate before calling

if (appService.load(appId) == null) {
  return ResponseEntity.badRequest().body("appId not found: " + appId);
}

Type guard

boolean appExistsInPortal(String appId, AppService svc) { return svc.load(appId) != null; }

Prevention

When it happens

Trigger: Requesting a config export for an appId that does not exist in the portal App table (typo, wrong portal instance, deleted app).

Common situations: Export script holds a stale appId; user targets the wrong portal/env; app was deleted but a bookmarked export link remains.

Related errors


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