{"record":{"id":"30154c400e2da805","repo":"apache/pulsar","slug":"ioexception-message","errorCode":null,"errorMessage":"<IOException message>","messagePattern":"<IOException message>","errorType":"http","errorClass":"RestException","httpStatus":500,"severity":"error","filePath":"pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java","lineNumber":1093,"sourceCode":"\n        return this.worker().getConnectorsManager().getConnectorDefinitions();\n    }\n\n    @Override\n    public void reloadConnectors(AuthenticationParameters authParams) {\n        if (!isWorkerServiceAvailable()) {\n            throwUnavailableException();\n        }\n        if (worker().getWorkerConfig().isAuthorizationEnabled()) {\n            // Only superuser has permission to do this operation.\n            if (!isSuperUser(authParams)) {\n                throw new RestException(Status.UNAUTHORIZED, \"This operation requires super-user access\");\n            }\n        }\n        try {\n            this.worker().getConnectorsManager().reloadConnectors(worker().getWorkerConfig());\n        } catch (IOException e) {\n            throw new RestException(Status.INTERNAL_SERVER_ERROR, e.getMessage());\n        }\n    }\n\n    @Override\n    public String triggerFunction(final String tenant,\n                                  final String namespace,\n                                  final String functionName,\n                                  final String input,\n                                  final InputStream uploadedInputStream,\n                                  final String topic,\n                                  final AuthenticationParameters authParams) {\n\n        if (!isWorkerServiceAvailable()) {\n            throwUnavailableException();\n        }\n\n        throwRestExceptionIfUnauthorizedForNamespace(tenant, namespace, functionName, \"trigger\", authParams);\n","sourceCodeStart":1075,"sourceCodeEnd":1111,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java#L1075-L1111","documentation":"reloadConnectors calls ConnectorsManager.reloadConnectors, which scans the connector directory from the worker config. If reading that directory or its connector archives/nar files throws an IOException, the worker converts it to an HTTP 500 Internal Server Error with the IOException's message.","triggerScenarios":"POST /functions/connectors/reload where the connectorsDirectory does not exist, is unreadable (filesystem permissions), or a connector .nar/.jar file is corrupted or partially written during the scan.","commonSituations":"Wrong connectorsDirectory path after relocating connectors; NFS/mount not available on the worker host; truncated .nar files from an interrupted upload; running the worker as a user without read permission on the directory.","solutions":["Verify connectorsDirectory in the worker config points to an existing, readable directory on the worker host.","Check filesystem permissions for the worker process user on the connector directory and archives.","Validate each .nar file (size, integrity); re-upload corrupted or partially copied connector archives.","Inspect the IOException message in the HTTP 500 response / worker logs — it names the exact file or path that failed."],"exampleFix":"// before (worker.conf)\nconnectorsDirectory=/opt/pulsar/connect-old\n// after\nconnectorsDirectory=/opt/pulsar/connectors  # must exist and be readable by the worker user","handlingStrategy":"validation","validationCode":"import java.nio.file.*;\nstatic void assertConnectorsDirReadable(Path dir) throws IOException {\n  if (!Files.isDirectory(dir)) throw new IOException(\"not a directory: \" + dir);\n  if (!Files.isReadable(dir)) throw new IOException(\"not readable: \" + dir);\n  try (DirectoryStream<Path> s = Files.newDirectoryStream(dir, \"*.nar\")) {\n    for (Path p : s) { if (Files.size(p) == 0) throw new IOException(\"empty nar: \" + p); }\n  }\n}","typeGuard":null,"tryCatchPattern":"try { reload(); }\ncatch (PulsarAdminException e) {\n  if (e.getResponseStatus() == 500) { alert(\"connector dir problem: \" + e.getMessage()); /* fs check */ }\n  else throw e;\n}","preventionTips":["Mount connector .nar files as read-only volumes and verify after deploy","Checksum connector archives post-upload","Add a health check that lists the connectors directory at worker startup"],"tags":["io","filesystem","pulsar-functions","connectors"],"backgroundTag":"io-error","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"}