{"record":{"id":"2325bdf577ea026b","repo":"apache/pulsar","slug":"e-getmessage-2325bd","errorCode":null,"errorMessage":"e.getMessage()","messagePattern":"e\\.getMessage\\(\\)","errorType":"http","errorClass":"RestException","httpStatus":500,"severity":"error","filePath":"pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SinksImpl.java","lineNumber":137,"sourceCode":"                }\n            }\n        } catch (PulsarAdminException.NotAuthorizedException e) {\n            log.error().attr(\"tenant\", tenant).attr(\"namespace\", namespace).attr(\"componentName\", sinkName)\n\n                    .attr(\"componentType\", ComponentTypeUtils.toString(componentType))\n\n                    .log(\"/ / Client is not authorized to operate on tenant\");\n            throw new RestException(Response.Status.UNAUTHORIZED, \"Client is not authorized to perform operation\");\n        } catch (PulsarAdminException.NotFoundException e) {\n            log.error().attr(\"tenant\", tenant).attr(\"namespace\", namespace).attr(\"componentName\", sinkName)\n\n                    .attr(\"tenant3\", tenant).log(\"/ / Tenant does not exist\");\n            throw new RestException(Response.Status.BAD_REQUEST, \"Tenant does not exist\");\n        } catch (PulsarAdminException e) {\n            log.error().attr(\"tenant\", tenant).attr(\"namespace\", namespace).attr(\"componentName\", sinkName)\n\n                    .exception(e).log(\"/ / Issues getting tenant data\");\n            throw new RestException(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage());\n        }\n\n        FunctionMetaDataManager functionMetaDataManager = worker().getFunctionMetaDataManager();\n\n        if (functionMetaDataManager.containsFunction(tenant, namespace, sinkName)) {\n            log.error().attr(\"componentType\", ComponentTypeUtils.toString(componentType)).attr(\"tenant\", tenant)\n\n                    .attr(\"namespace\", namespace).attr(\"componentName\", sinkName).log(\"/ / already exists\");\n            throw new RestException(Response.Status.BAD_REQUEST,\n                    String.format(\"%s %s already exists\", ComponentTypeUtils.toString(componentType), sinkName));\n        }\n\n        FunctionDetails functionDetails;\n        File componentPackageFile = null;\n        try {\n\n            // validate parameters\n            try {","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SinksImpl.java#L119-L155","documentation":"registerSink catches the generic PulsarAdminException (any non-auth, non-not-found admin failure while fetching tenant data) and rethrows it as a 500 INTERNAL_SERVER_ERROR RestException carrying e.getMessage(). This signals the worker could not complete its tenant-existence validation because of an infrastructure-level problem talking to the broker/admin API.","triggerScenarios":"registerSink when the admin lookup for tenant data fails for reasons other than authorization/not-found: broker connection dropped, TLS handshake failure, timeouts, broker overload, or PulsarAdmin client misconfiguration on the worker.","commonSituations":"Broker down or restarting; network partition between functions worker and broker; certificate/truststore misconfiguration producing generic admin exceptions; broker returning 5xx under load.","solutions":["Check broker health and connectivity from the worker host (service URL, port, TLS).","Read the underlying cause: the worker log includes the full exception; the REST message is just e.getMessage().","Retry the request once brokers recover - this is typically transient.","Verify the worker's PulsarAdmin configuration (auth, TLS truststore, serviceUrl) matches the broker's."],"exampleFix":"// before: ignoring connection settings on the worker\n# worker.conf: webServiceUrl=http://broker:8080 (broker TLS-only)\n// after\n# worker.conf: webServiceUrl=https://broker:8443, tlsTrustCertsFilePath=/etc/pulsar/ca.crt","handlingStrategy":"retry","validationCode":"// preflight connectivity check\nadmin.brokers().getActiveBrokers(cluster); // fails fast if the broker/admin endpoint is unreachable","typeGuard":null,"tryCatchPattern":"try {\n    sinks.registerSink(tenant, ns, name, cfg, null, null, null, authParams);\n} catch (RestException e) {\n    if (e.getResponse().getStatus() == 500) {\n        // transient broker/admin failure: back off and retry with a retry policy\n    } else { throw e; }\n}","preventionTips":["Monitor broker health and worker-to-broker connectivity; alert on admin API failures","Match the worker's PulsarAdmin TLS/auth settings exactly to the broker's","Wrap administrative deployments in bounded retry with exponential backoff"],"tags":["rest-api","internal-server-error","network","pulsar-sinks"],"backgroundTag":"broker-connection-failed","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"}