{"record":{"id":"e1c7d113e229b196","repo":"quarkusio/quarkus","slug":"failed-to-determine-working-socket-addresses-for-s","errorCode":null,"errorMessage":"Failed to determine working socket addresses for service-name: ${serviceName}","messagePattern":"Failed to determine working socket addresses for service-name: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/stork/StorkGrpcChannel.java","lineNumber":211,"sourceCode":"\n    private void checkSocketAddress(Context context) {\n        ServiceInstance instance = context.instance;\n        Set<InetSocketAddress> socketAddresses = new HashSet<>();\n        try {\n            for (InetAddress inetAddress : InetAddress.getAllByName(instance.getHost())) {\n                socketAddresses.add(new InetSocketAddress(inetAddress, instance.getPort()));\n            }\n        } catch (UnknownHostException e) {\n            log.warn(\"Ignoring wrong host: '{}' for service name '{}'\", instance.getHost(), serviceName, e);\n        }\n\n        if (!socketAddresses.isEmpty()) {\n            context.address = socketAddresses.iterator().next(); // pick first\n        } else {\n            long serviceId = instance.getId();\n            services.remove(serviceId);\n            channels.remove(serviceId);\n            throw new IllegalStateException(\"Failed to determine working socket addresses for service-name: \" + serviceName);\n        }\n    }\n\n    private static class StorkDelayedClientCall<RequestT, ResponseT> extends DelayedClientCall<RequestT, ResponseT> {\n        public StorkDelayedClientCall(Executor callExecutor, ScheduledExecutorService scheduler, @Nullable Deadline deadline) {\n            super(callExecutor, scheduler, deadline);\n        }\n    }\n}\n","sourceCodeStart":193,"sourceCodeEnd":221,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/stork/StorkGrpcChannel.java#L193-L221","documentation":"StorkGrpcChannel.checkSocketAddress selects an instance from Stork service discovery and tries to derive usable gRPC socket addresses from it. When the selected Stork ServiceInstance yields no working socket address, the instance and its cached channel are evicted and an IllegalStateException is thrown, because gRPC cannot connect without an IP:port (or domain socket) target.","triggerScenarios":"Stork service discovery returned a ServiceInstance whose address/port is absent, empty, or not expressible as a socket address (e.g. discovery type returns metadata-only instances, wrong port config, or a hostname that fails InetSocketAddress resolution), leaving socketAddresses empty in checkSocketAddress.","commonSituations":"Consul/Kubernetes registration missing the port or exposing a metadata port; static address-list entries malformed; service registered with secure=false/true mismatch leading to unusable port; DNS name not resolvable from the container.","solutions":["Check the Stork discovery config: ensure address-list entries are host:port and the port is the gRPC server port.","Verify the discovered instance is healthy and registered with an address + port (inspect Consul/K8s registry).","Fix DNS resolution inside the runtime environment (container networking, search domains).","Retain retries: the error already evicts the bad instance; ensure your call path retries the next Stork instance (set quarkus.grpc.clients.<name>.retry or application-level retry)."],"exampleFix":"// before\nquarkus.stork.hello.service-discovery.address-list=my-service\n\n// after\nquarkus.stork.hello.service-discovery.address-list=my-service:9000","handlingStrategy":"retry","validationCode":"// pre-flight: ensure discovery returns instances with usable addresses\nServiceInstance si = Stork.getInstance().getService(\"hello\")\n    .getInstances().await().indefinitely().stream().findFirst().orElseThrow();\nif (si.getAddress() == null || si.getPort() <= 0) {\n    throw new IllegalStateException(\"Stork instance has no usable host:port\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    return stub.sayHello(req).await(indefinitely());\n} catch (IllegalStateException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"working socket addresses\")) {\n        // instance evicted by the channel; retry picks the next Stork instance\n        return retryWithBackoff(() -> stub.sayHello(req), 3);\n    }\n    throw e;\n}","preventionTips":["Ensure the registry (Consul/K8s/static) records correct host and gRPC port.","Check DNS resolution from inside the runtime container.","Add client-side retry so a bad instance is skipped automatically."],"tags":["grpc","stork","service-discovery","network"],"backgroundTag":"no-usable-service-address","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}