{"record":{"id":"9fc64a20db25bc7f","repo":"openzipkin/zipkin","slug":"serviceurl-is-null-or-empty","errorCode":null,"errorMessage":"serviceUrl is null or empty","messagePattern":"serviceUrl is null or empty","errorType":"validation","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"zipkin-collector/pulsar/src/main/java/zipkin2/collector/pulsar/PulsarCollector.java","lineNumber":78,"sourceCode":"    }\n\n    /** Count of concurrent message consumers on the topic. Defaults to 1. */\n    public Builder concurrency(Integer concurrency) {\n      if (concurrency < 1) throw new IllegalArgumentException(\"concurrency < 1\");\n      this.concurrency = concurrency;\n      return this;\n    }\n\n    /** Queue zipkin spans will be consumed from. Defaults to \"zipkin\". */\n    public Builder topic(String topic) {\n      if (StringUtils.isNullOrEmpty(topic)) throw new NullPointerException(\"topic is null or empty\");\n      this.topic = topic;\n      return this;\n    }\n\n    /** The service URL for the Pulsar client ex. pulsar://my-broker:6650. No default. */\n    public Builder serviceUrl(String serviceUrl) {\n      if (StringUtils.isNullOrEmpty(serviceUrl)) throw new NullPointerException(\"serviceUrl is null or empty\");\n      clientProps.put(\"serviceUrl\", serviceUrl);\n      return this;\n    }\n\n    /** Specify the subscription name for this consumer. No default. */\n    public Builder subscriptionName(String subscriptionName) {\n      if (StringUtils.isNullOrEmpty(subscriptionName)) throw new NullPointerException(\"serviceUrl is null or empty\");\n      consumerProps.put(\"subscriptionName\", subscriptionName);\n      return this;\n    }\n\n    /**\n     * Any properties set here will override the previous Pulsar client configuration.\n     *\n     * @param clientPropsMap Map<String, Object>\n     * @return Builder\n     * @see org.apache.pulsar.client.api.ClientBuilder#loadConf(Map)\n     */","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/openzipkin/zipkin/blob/878ce2a1fad54ca941d17fdcf2e1d924b148eb1f/zipkin-collector/pulsar/src/main/java/zipkin2/collector/pulsar/PulsarCollector.java#L60-L96","documentation":"PulsarCollector.Builder.serviceUrl(String) throws NullPointerException when the service URL is null or empty. The service URL (e.g. pulsar://my-broker:6650) has no default — it is the only mandatory Pulsar setting — so the builder enforces its presence at configuration time, before any network call.","triggerScenarios":"Calling .serviceUrl(null) or .serviceUrl(\"\") — typically an unset PULSAR_SERVICE_URL environment variable or missing config key in the deployment.","commonSituations":"Deployment manifests (Docker/K8s) where the Pulsar address env var is forgotten in one environment, or config templating leaves the value blank.","solutions":["Set the service URL explicitly: .serviceUrl(\"pulsar://my-broker:6650\")","Require the env var at startup: Objects.requireNonNull(System.getenv(\"PULSAR_SERVICE_URL\")) before building","Fix the deployment manifest/config template so the value is never blank"],"exampleFix":"// before\nbuilder.serviceUrl(System.getenv(\"PULSAR_SERVICE_URL\")); // null when unset\n\n// after\nString url = Objects.requireNonNull(\n  System.getenv(\"PULSAR_SERVICE_URL\"), \"PULSAR_SERVICE_URL must be set\");\nbuilder.serviceUrl(url);","handlingStrategy":"validation","validationCode":"String url = Objects.requireNonNull(System.getenv(\"PULSAR_SERVICE_URL\"),\n  \"PULSAR_SERVICE_URL is required (e.g. pulsar://my-broker:6650)\");\nbuilder.serviceUrl(url);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Fail fast at startup when required env vars are missing — the error will name your var, not a bare NPE","Include the expected format in the startup error message"],"tags":["pulsar","zipkin","builder","null-check","configuration"],"backgroundTag":null,"analyzedSha":"878ce2a1fad54ca941d17fdcf2e1d924b148eb1f","analyzedAt":"2026-08-14T15:17:09.895Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}