{"record":{"id":"a0cf70497ba4e0e9","repo":"apache/dubbo","slug":"no-registry-instance-in-zone-or-no-available-provi","errorCode":null,"errorMessage":"No registry instance in zone or no available providers in the registry, zone: {zone}, registries: {invokers.stream().map(...).collect(Collectors.joining(\",\"))}","messagePattern":"No registry instance in zone or no available providers in the registry, zone: (.+?), registries: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/registry/ZoneAwareClusterInvoker.java","lineNumber":96,"sourceCode":"        RpcContext rpcContext = RpcContext.getClientAttachment();\n        String zone = rpcContext.getAttachment(REGISTRY_ZONE);\n        String force = rpcContext.getAttachment(REGISTRY_ZONE_FORCE);\n        if (StringUtils.isEmpty(zone) && zoneDetector != null) {\n            zone = zoneDetector.getZoneOfCurrentRequest(invocation);\n            force = zoneDetector.isZoneForcingEnabled(invocation, zone);\n        }\n\n        // providers in the registry with the same zone\n        if (StringUtils.isNotEmpty(zone)) {\n            for (Invoker<T> invoker : invokers) {\n                ClusterInvoker<T> clusterInvoker = (ClusterInvoker<T>) invoker;\n                if (clusterInvoker.isAvailable()\n                        && zone.equals(clusterInvoker.getRegistryUrl().getParameter(ZONE_KEY))) {\n                    return clusterInvoker.invoke(invocation);\n                }\n            }\n            if (StringUtils.isNotEmpty(force) && \"true\".equalsIgnoreCase(force)) {\n                throw new IllegalStateException(\n                        \"No registry instance in zone or no available providers in the registry, zone: \"\n                                + zone\n                                + \", registries: \"\n                                + invokers.stream()\n                                        .map(invoker -> ((ClusterInvoker<T>) invoker)\n                                                .getRegistryUrl()\n                                                .toString())\n                                        .collect(Collectors.joining(\",\")));\n            }\n        }\n\n        // load balance among all registries, with registry weight count in.\n        Invoker<T> balancedInvoker = select(loadbalance, invocation, invokers, null);\n        if (balancedInvoker != null && balancedInvoker.isAvailable()) {\n            return balancedInvoker.invoke(invocation);\n        }\n\n        // If none of the invokers has a preferred signal or is picked by the loadbalancer, pick the first one","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/registry/ZoneAwareClusterInvoker.java#L78-L114","documentation":"Thrown by ZoneAwareClusterInvoker as an IllegalStateException when a request carries a registry zone (REGISTRY_ZONE attachment or ZoneDetector), the zone-force flag (REGISTRY_ZONE_FORCE) is 'true', yet no available registry/invoker matches that zone. It is a hard failure that refuses to spill traffic to other zones because the caller demanded strict zone affinity.","triggerScenarios":"A consumer sets the registry.zone attachment (or a ZoneDetector returns a zone) plus registry.zone.force=true, and every registry either lacks that zone tag or has no available providers in that zone. The exception lists the candidate registries for diagnosis.","commonSituations":"Misconfigured zone tag on the registry side (registry.zone mismatch between consumer and provider registries); a datacenter/zone is down while force-zone is enabled; ZoneDetector logic returns a zone id that no registry ever advertises; deploying zone-aware routing before tagging provider registries.","solutions":["Verify each registry's registry.zone parameter matches the zones the consumer requests, on both consumer and provider registry URLs.","If spilling across zones on failure is acceptable, set registry.zone.force=false (or omit it) so ZoneAwareClusterInvoker falls back to weighted load balancing.","Bring up / register providers in the requested zone, or remap the consumer's zone to a populated one via the ZoneDetector.","Check the listed registries in the message to confirm which are missing the zone tag or have zero available providers."],"exampleFix":"// before: force-zone with no matching zone providers -> hard fail\nRpcContext.getClientAttachment().setAttachment(\"registry.zone\", \"us-east-1a\");\nRpcContext.getClientAttachment().setAttachment(\"registry.zone.force\", \"true\");\n\n// after: relax force so fallback load balancing can serve the call\nRpcContext.getClientAttachment().setAttachment(\"registry.zone.force\", \"false\");","handlingStrategy":"validation","validationCode":"// Before forcing a zone, confirm a registry advertises it\nboolean zoneExists = invokers.stream()\n    .anyMatch(i -> zone.equals(((ClusterInvoker<?>) i).getRegistryUrl().getParameter(\"registry.zone\")));\nif (!zoneExists) {\n    log.warn(\"no registry tagged zone={} ; force will fail\", zone);\n}","typeGuard":null,"tryCatchPattern":"try {\n    return service.call(req);\n} catch (IllegalStateException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"No registry instance in zone\")) {\n        // zone unavailable + force on; decide whether to relax or fail\n        log.error(\"zone-forced call failed; consider disabling zone.force\", e);\n    }\n    throw e;\n}","preventionTips":["Tag every registry with registry.zone on both consumer and provider sides before enabling force.","Only enable registry.zone.force=true once the zone is reliably populated.","Use a ZoneDetector that maps to zones you actually run."],"tags":["cluster","zone-aware","registry","multi-registry","zone-affinity"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}