{"record":{"id":"07f6abade2d89659","repo":"quarkusio/quarkus","slug":"unable-to-find-the-grpcclientconfigprovider","errorCode":null,"errorMessage":"Unable to find the GrpcClientConfigProvider","messagePattern":"Unable to find the GrpcClientConfigProvider","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/Channels.java","lineNumber":88,"sourceCode":"import io.vertx.grpcio.client.GrpcIoClient;\nimport io.vertx.grpcio.client.GrpcIoClientChannel;\n\n@SuppressWarnings({ \"OptionalIsPresent\" })\npublic class Channels {\n\n    private static final Logger LOGGER = Logger.getLogger(Channels.class.getName());\n\n    private Channels() {\n        // Avoid direct instantiation\n    }\n\n    @SuppressWarnings(\"rawtypes\")\n    public static Channel createChannel(String name, Set<String> perClientInterceptors) throws Exception {\n        ArcContainer container = Arc.container();\n\n        InstanceHandle<GrpcClientConfigProvider> instance = container.instance(GrpcClientConfigProvider.class);\n        if (!instance.isAvailable()) {\n            throw new IllegalStateException(\"Unable to find the GrpcClientConfigProvider\");\n        }\n        instance.get();\n\n        SmallRyeConfig config = ConfigProvider.getConfig().unwrap(SmallRyeConfig.class);\n        GrpcConfiguration grpcConfig = config.getConfigMapping(GrpcConfiguration.class);\n        GrpcClientConfiguration clientConfig = grpcConfig.clients().get(name);\n\n        String host = clientConfig.host();\n        int port = clientConfig.port();\n        if (LaunchMode.current() == LaunchMode.TEST) {\n            if (clientConfig.testPort().isPresent()) {\n                port = clientConfig.testPort().getAsInt();\n            } else {\n                boolean clientUsesTls = clientConfig.tlsConfigurationName().isPresent() || clientConfig.tls().enabled()\n                        || (clientConfig.plainText().isPresent() && !clientConfig.plainText().get());\n                ValueRegistry valueRegistry = container.instance(ValueRegistry.class).get();\n                HttpServer httpServer = valueRegistry.get(HttpServer.HTTP_SERVER);\n                int actualPort = clientUsesTls ? httpServer.getSecurePort() : httpServer.getPort();","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/Channels.java#L70-L106","documentation":"Channels.createChannel resolves gRPC client configuration at runtime through the GrpcClientConfigProvider bean registered in the CDI container. If the Arc container has no GrpcClientConfigProvider bean available, channel creation cannot read quarkus.grpc.clients.* config and fails fast with IllegalStateException. This normally means the Quarkus gRPC deployment-time wiring did not run (e.g. code executed outside a Quarkus application, or in tests without the gRPC extension).","triggerScenarios":"Calling Channels.createChannel(name, perClientInterceptors) directly (or via code paths that build channels manually) when Arc.container().instance(GrpcClientConfigProvider.class).isAvailable() is false — typically running in a plain JUnit test, a non-Quarkus runtime, or an application where the gRPC deployment processor never registered the provider bean.","commonSituations":"Unit tests that instantiate gRPC clients without @QuarkusTest; using the gRPC runtime classes in a library consumed by a non-Quarkus app; startup ordering where the container is not yet initialized (Arc.container() null).","solutions":["Run the code inside a Quarkus application / @QuarkusTest so the GrpcClientConfigProvider bean is registered by the gRPC extension.","Obtain channels through the supported API: @Inject GrpcClient / Mutiny gRPC service stubs instead of calling Channels.createChannel manually.","Add the quarkus-grpc extension dependency to the module (the provider is registered by the deployment module at build time).","If in a test, annotate with @QuarkusTest and let the container start before creating clients."],"exampleFix":"// before\nChannel ch = Channels.createChannel(\"hello\", Set.of());\n\n// after\n@QuarkusTest\nclass MyTest {\n  @InjectMock\r\n  // or better:\n  @GrpcClient(\"hello\")\n  Greeter greeter; // managed channel created by Quarkus\n}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"boolean grpcConfigAvailable() {\n    io.quarkus.arc.ArcContainer container = io.quarkus.arc.Arc.container();\n    return container != null\n        && container.instance(io.quarkus.grpc.runtime.config.GrpcClientConfigProvider.class).isAvailable();\n}","tryCatchPattern":"try {\n    Channel ch = Channels.createChannel(\"hello\", Set.of());\n} catch (IllegalStateException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"GrpcClientConfigProvider\")) {\n        throw new IllegalStateException(\"Channels.createChannel requires a running Quarkus app; use @GrpcClient injection instead\", e);\n    }\n    throw e;\n}","preventionTips":["Never call Channels.createChannel outside a started Quarkus container.","Always obtain gRPC clients via @GrpcClient injection or Quarkus-managed beans.","Use @QuarkusTest in tests that need real channels."],"tags":["grpc","cdi","configuration","quarkus"],"backgroundTag":"cdi-bean-not-found","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"}