{"record":{"id":"6900060d38cd8318","repo":"quarkusio/quarkus","slug":"no-service-definition-for-servicename-servicenam","errorCode":null,"errorMessage":"No service definition for serviceName ${serviceName} found.","messagePattern":"No service definition for serviceName (.+?) found\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/stork/StorkGrpcChannel.java","lineNumber":78,"sourceCode":"        AtomicReference<ServiceInstance> ref;\n    }\n\n    public StorkGrpcChannel(GrpcClient client, String serviceName, GrpcClientConfiguration.StorkConfig stork,\n            Executor executor) {\n        this.client = client;\n        this.serviceName = serviceName;\n        this.stork = stork;\n        this.executor = executor;\n        this.scheduler = new ScheduledThreadPoolExecutor(stork.threads());\n        this.scheduler.scheduleAtFixedRate(this::refresh, stork.delay(), stork.period(), TimeUnit.SECONDS);\n    }\n\n    @Override\n    public <RequestT, ResponseT> ClientCall<RequestT, ResponseT> newCall(MethodDescriptor<RequestT, ResponseT> methodDescriptor,\n            CallOptions callOptions) {\n        Service service = Stork.getInstance().getService(serviceName);\n        if (service == null) {\n            throw new IllegalStateException(\"No service definition for serviceName \" + serviceName + \" found.\");\n        }\n\n        Context context = new Context();\n        context.service = service;\n        // handle this calls here\n        Boolean measureTime = STORK_MEASURE_TIME.get();\n        context.measureTime = measureTime != null && measureTime;\n        context.ref = STORK_SERVICE_INSTANCE.get();\n\n        // The DelayedClientCall must deliver its listener callbacks on the call's\n        // own executor. Blocking stubs pass a per-call ThreadlessExecutor through\n        // CallOptions and park the calling thread draining it; if the callbacks\n        // (e.g. the close after a failed Stork resolution) are delivered on a\n        // different executor, that thread is never woken and the call hangs.\n        Executor callExecutor = callOptions.getExecutor() != null ? callOptions.getExecutor() : executor;\n        DelayedClientCall<RequestT, ResponseT> delayed = new StorkDelayedClientCall<>(callExecutor, scheduler,\n                Deadline.after(stork.deadline(), TimeUnit.MILLISECONDS));\n","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/stork/StorkGrpcChannel.java#L60-L96","documentation":"When a gRPC client channel uses the Stork name resolver, StorkGrpcChannel.newCall looks up the Service definition by serviceName in the Stork registry. If Stork has no service registered under that name, the call cannot be routed and an IllegalStateException is thrown immediately, before any network I/O.","triggerScenarios":"quarkus.grpc.clients.<name>.name-resolver=stork is set (or @GrpcClient with stork) while quarkus.stork.<serviceName>.service-discovery.* is missing or the service name in the config differs from the Stork-registered name, so Stork.getInstance().getService(serviceName) returns null on the first newCall.","commonSituations":"Typos between the gRPC client config name and the quarkus.stork.<service> key; migrating a client to Stork without adding the service-discovery block; service name containing characters that need different casing in properties.","solutions":["Define the service in Stork config: quarkus.stork.<serviceName>.service-discovery.type=static (or consul/kubernetes etc.) with address-list.","Make sure the Stork service name matches the gRPC client name exactly (the value used in quarkus.grpc.clients.<name> or @GrpcClient).","Add the required Stork service-discovery dependency (e.g. smallrye-stork-service-discovery-static / consul / kubernetes).","Verify at startup with `Stork.getInstance().getServiceNames()` or the Stork Dev UI that the service is registered."],"exampleFix":"// before (application.properties)\nquarkus.grpc.clients.hello.name-resolver=stork\n\n// after\nquarkus.grpc.clients.hello.name-resolver=stork\nquarkus.stork.hello.service-discovery.type=static\nquarkus.stork.hello.service-discovery.address-list=localhost:8084","handlingStrategy":"validation","validationCode":"// verify the service is registered in Stork before issuing calls\nimport io.smallrye.stork.Stork;\nif (Stork.getInstance().getService(\"hello\") == null) {\n    throw new IllegalStateException(\"Stork service 'hello' not defined - add quarkus.stork.hello.service-discovery.*\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    GreeterGrpc.GreeterBlockingStub stub = client;\n    stub.sayHello(req);\n} catch (IllegalStateException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"No service definition\")) {\n        throw new ConfigurationException(\"Add quarkus.stork.<service>.service-discovery config for \" + e.getMessage());\n    }\n    throw e;\n}","preventionTips":["Keep the Stork service name identical to the quarkus.grpc.clients key.","Assert required Stork definitions in a @Startup bean or test.","Use the Stork Dev UI / getServiceNames() during development to confirm registration."],"tags":["grpc","stork","service-discovery","configuration"],"backgroundTag":"stork-service-not-registered","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}