{"record":{"id":"7f7ecc2f091cafe7","repo":"apolloconfig/apollo","slug":"no-such-instance-of-instanceid","errorCode":null,"errorMessage":"No such instance of instanceId: ","messagePattern":"No such instance of instanceId: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/v1/controller/PortalManagementController.java","lineNumber":570,"sourceCode":"\n    String version = ApolloServer.VERSION;\n    if (!Objects.equals(version, \"java-null\")) {\n      systemInfo.setVersion(version);\n    }\n\n    for (Env env : portalSettings.getAllEnvs()) {\n      systemInfo.addEnvironment(adaptEnv2EnvironmentInfo(env));\n    }\n    return ResponseEntity.ok(systemInfo);\n  }\n\n  @Override\n  @PreAuthorize(value = \"@unifiedPermissionValidator.isSuperAdmin()\")\n  public ResponseEntity<Object> checkSystemHealth(String instanceId) {\n    requirePortalUserRequest();\n    ServiceDTO service = findServiceByInstanceId(instanceId);\n    if (service == null) {\n      throw new IllegalArgumentException(\"No such instance of instanceId: \" + instanceId);\n    }\n    Health health =\n        getRestTemplate().getForObject(service.getHomepageUrl() + \"/health\", Health.class);\n    return ResponseEntity.ok(health);\n  }\n\n  @Override\n  @PreAuthorize(value = \"@unifiedPermissionValidator.isSuperAdmin()\")\n  public ResponseEntity<Resource> exportAllConfigs(String envs) {\n    requirePortalUserRequest();\n    String filename =\n        \"apollo_config_export_\" + DateFormatUtils.format(new Date(), \"yyyy_MMdd_HH_mm_ss\") + \".zip\";\n    List<Env> exportEnvs = Splitter.on(ENV_SEPARATOR).splitToList(envs).stream().map(this::parseEnv)\n        .collect(Collectors.toList());\n\n    return exportZipResource(filename,\n        outputStream -> configsExportService.exportData(outputStream, exportEnvs),\n        \"export configs failed\");","sourceCodeStart":552,"sourceCodeEnd":588,"githubUrl":"https://github.com/apolloconfig/apollo/blob/d95fc18d112589efc09ddcbe1507047584d55251/apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/v1/controller/PortalManagementController.java#L552-L588","documentation":"Thrown in checkSystemHealth when the provided instanceId does not match any registered Apollo service instance across all configured environments. The controller iterates all envs and all admin/config services looking for a matching instanceId; if none is found, the IllegalArgumentException is thrown. The instanceId corresponds to a specific running Apollo service process.","triggerScenarios":"A super-admin calls the system health check endpoint with an instanceId that is not currently registered in any environment's admin or config service list (e.g. from Discovery).","commonSituations":"The instance went down or was deregistered between the time the caller fetched its ID and the time of the health check; the instanceId was copy-pasted incorrectly; or the instance belongs to a different Apollo cluster/deployment.","solutions":["Refresh the list of registered instances via the system-info endpoint and use a current, valid instanceId.","Verify the instanceId string matches exactly (no trailing spaces, correct case).","If the instance is genuinely down, it will not appear in the registry — restart it or check Eureka/Consul registration."],"exampleFix":"// before\nGET /system/health?instanceId=stale-or-wrong-id\n\n// after: fetch a valid instanceId first\nGET /system/info  // returns current registered instances\nGET /system/health?instanceId=<valid-id-from-above>","handlingStrategy":"validation","validationCode":"// Fetch valid instance IDs before calling health check\nList<ServiceDTO> instances = getRegisteredInstances();\nboolean valid = instances.stream().anyMatch(s -> instanceId.equals(s.getInstanceId()));\nif (!valid) {\n  throw new IllegalArgumentException(\"Invalid or stale instanceId: \" + instanceId);\n}","typeGuard":null,"tryCatchPattern":"try {\n  health = checkSystemHealth(instanceId);\n} catch (IllegalArgumentException e) {\n  // refresh instance list and retry with a valid ID, or report instance as down\n}","preventionTips":["Always fetch the current instance list from the system-info endpoint before health checks.","Cache instanceIds with a short TTL since registrations change.","Handle the case where an instance deregisters between list and health check."],"tags":["validation","openapi","bad-request","system-health","instance","apollo-portal"],"backgroundTag":null,"analyzedSha":"d95fc18d112589efc09ddcbe1507047584d55251","analyzedAt":"2026-08-14T04:00:05.477Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}