{"record":{"id":"83cb2dba9e43f77e","repo":"apolloconfig/apollo","slug":"app-not-found","errorCode":null,"errorMessage":"App not found: {}","messagePattern":"App not found: (.+?)","errorType":"validation","errorClass":"BadRequestException","httpStatus":400,"severity":"warning","filePath":"apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ConfigsExportService.java","lineNumber":117,"sourceCode":"\n    exportApps(exportEnvs, outputStream);\n  }\n\n  /**\n   * Export all configurations of an application in a specified environment and cluster\n   * <p>\n   * File Struts:\n   * <p>\n   *\n   * List<App> -> List<Env> -> List<Namespace>\n   *\n   * @param outputStream network file download stream to user\n   */\n  public void exportAppConfigByEnvAndCluster(String appId, Env env, String clusterName,\n      OutputStream outputStream) {\n    App app = appService.load(appId);\n    if (app == null) {\n      throw new BadRequestException(\"App not found: \" + appId);\n    }\n    ClusterDTO cluster = clusterService.loadCluster(appId, env, clusterName);\n    if (cluster == null) {\n      throw new BadRequestException(\n          \"The app does not exist in the specified environment and cluster.\");\n    }\n\n    try (final ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream)) {\n      try {\n        this.exportNamespaces(env, app, cluster, zipOutputStream, true);\n      } catch (BadRequestException badRequestException) {\n        // ignore\n      } catch (Exception e) {\n        logger.error(\"export namespace error. appId = {}, env = {}, cluster = {}\", app.getAppId(),\n            env.getName(), cluster.getName(), e);\n      }\n    } catch (IOException e) {\n      logger.error(\"export app config error\", e);","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/apolloconfig/apollo/blob/d95fc18d112589efc09ddcbe1507047584d55251/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ConfigsExportService.java#L99-L135","documentation":"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.","triggerScenarios":"Requesting a config export for an appId that does not exist in the portal App table (typo, wrong portal instance, deleted app).","commonSituations":"Export script holds a stale appId; user targets the wrong portal/env; app was deleted but a bookmarked export link remains.","solutions":["Verify appService.load(appId) != null (or app exists in the portal UI) before exporting.","Correct the appId or target the portal that owns the app.","Restore the app record if it was deleted in error."],"exampleFix":"// before\nconfigsExportService.exportAppConfigByEnvAndCluster(appId, env, cluster, out);\n\n// after\nif (appService.load(appId) == null) {\n  throw new IllegalArgumentException(\"appId \" + appId + \" not found in this portal\");\n}\nconfigsExportService.exportAppConfigByEnvAndCluster(appId, env, cluster, out);","handlingStrategy":"validation","validationCode":"if (appService.load(appId) == null) {\n  return ResponseEntity.badRequest().body(\"appId not found: \" + appId);\n}","typeGuard":"boolean appExistsInPortal(String appId, AppService svc) { return svc.load(appId) != null; }","tryCatchPattern":null,"preventionTips":["Confirm the appId exists in the target portal before exporting.","Target the portal that owns the app."],"tags":["apollo-portal","config-export","validation","app-not-found"],"backgroundTag":null,"analyzedSha":"d95fc18d112589efc09ddcbe1507047584d55251","analyzedAt":"2026-08-14T04:00:05.477Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}