{"record":{"id":"565b98d1e25ab8cc","repo":"apache/pulsar","slug":"invalid-client-configuration","errorCode":null,"errorMessage":"Invalid client configuration","messagePattern":"Invalid client configuration","errorType":"exception","errorClass":"PulsarClientException.InvalidConfigurationException","httpStatus":null,"severity":"error","filePath":"pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java","lineNumber":266,"sourceCode":"                            ScheduledExecutorProvider scheduledExecutorProvider)\n            throws PulsarClientException {\n        this(conf, eventLoopGroup, connectionPool, timer, externalExecutorProvider, internalExecutorProvider,\n                scheduledExecutorProvider, null, null, null);\n    }\n\n    @Builder(builderClassName = \"PulsarClientImplBuilder\")\n    PulsarClientImpl(ClientConfigurationData conf, EventLoopGroup eventLoopGroup, ConnectionPool connectionPool,\n                     Timer timer, ExecutorProvider externalExecutorProvider,\n                     ExecutorProvider internalExecutorProvider,\n                     ScheduledExecutorProvider scheduledExecutorProvider,\n                     ExecutorProvider lookupExecutorProvider,\n                     DnsResolverGroupImpl dnsResolverGroup,\n                     MemoryLimitController memoryLimitController) throws PulsarClientException {\n        EventLoopGroup eventLoopGroupReference = null;\n        ConnectionPool connectionPoolReference = null;\n        try {\n            if (conf == null || isBlank(conf.getServiceUrl())) {\n                throw new PulsarClientException.InvalidConfigurationException(\"Invalid client configuration\");\n            }\n            this.conf = conf;\n            this.createdEventLoopGroup = eventLoopGroup == null;\n            this.createdCnxPool = connectionPool == null;\n            if ((externalExecutorProvider == null) != (internalExecutorProvider == null)) {\n                throw new IllegalArgumentException(\n                        \"Both externalExecutorProvider and internalExecutorProvider must be specified or unspecified.\");\n            }\n            this.createdExecutorProviders = externalExecutorProvider == null;\n            this.createdScheduledProviders = scheduledExecutorProvider == null;\n            this.createdLookupProviders = lookupExecutorProvider == null;\n            eventLoopGroupReference = eventLoopGroup != null ? eventLoopGroup :\n                    PulsarClientResourcesConfigurer.createEventLoopGroup(conf);\n            this.eventLoopGroup = eventLoopGroupReference;\n            this.instrumentProvider = new InstrumentProvider(conf.getOpenTelemetry());\n            clientClock = conf.getClock();\n            this.scheduledExecutorProvider = scheduledExecutorProvider != null ? scheduledExecutorProvider :\n                    PulsarClientResourcesConfigurer.createScheduledExecutorProvider(conf);","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java#L248-L284","documentation":"Thrown from the PulsarClientImpl constructor when the ClientConfigurationData is null or its serviceUrl is blank. A client cannot resolve brokers without a service URL, so construction fails immediately with InvalidConfigurationException instead of deferring the failure to the first operation.","triggerScenarios":"new PulsarClientImpl(conf, ...) with a null conf, or a conf built without calling serviceUrl(...), or with serviceUrl set to an empty/whitespace string.","commonSituations":"Building ClientConfigurationData programmatically and skipping serviceUrl; loading config from a file where the serviceUrl key is missing; passing a config object that failed to deserialize.","solutions":["Set a valid service URL, e.g. conf.setServiceUrl(\"pulsar://broker:6650\") or PulsarClient.builder().serviceUrl(...).","Validate the loaded configuration (non-null conf, non-blank serviceUrl) before constructing the client.","Check that your properties/YAML file actually contains the serviceUrl key and that it was loaded into the conf object."],"exampleFix":"// before\nClientConfigurationData conf = new ClientConfigurationData();\nPulsarClient client = new PulsarClientImpl(conf, eventLoopGroup); // blank serviceUrl\n// after\nconf.setServiceUrl(\"pulsar://localhost:6650\");\nPulsarClient client = new PulsarClientImpl(conf, eventLoopGroup);","handlingStrategy":"validation","validationCode":"if (conf == null || conf.getServiceUrl() == null || conf.getServiceUrl().isBlank()) {\n    throw new IllegalArgumentException(\"Client configuration requires a non-blank serviceUrl\");\n}\nnew PulsarClientImpl(conf, eventLoopGroup);","typeGuard":null,"tryCatchPattern":"try {\n    client = new PulsarClientImpl(conf, eventLoopGroup);\n} catch (PulsarClientException.InvalidConfigurationException e) {\n    log.error(\"Invalid client config: serviceUrl missing/blank\", e);\n    throw e;\n}","preventionTips":["Prefer PulsarClient.builder().serviceUrl(...).build() which enforces the URL.","Load config from env/file with a required-field check for serviceUrl before constructing.","Never construct ClientConfigurationData by hand without setting serviceUrl."],"tags":["pulsar","client-configuration","invalid-configuration"],"backgroundTag":"missing-service-url","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}