{"record":{"id":"c88073583fbffe80","repo":"apache/pulsar","slug":"could-not-open-configuration-file","errorCode":null,"errorMessage":"Could not open configuration file","messagePattern":"Could not open configuration file","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-broker/src/main/java/org/apache/pulsar/PulsarBrokerStarter.java","lineNumber":117,"sourceCode":"        @Option(names = {\"-fwc\", \"--functions-worker-conf\"}, description = \"Configuration file for Functions Worker\")\n        private String fnWorkerConfigFile = \"conf/functions_worker.yml\";\n\n        @Option(names = {\"-h\", \"--help\"}, usageHelp = true, description = \"Show this help message\")\n        private boolean help = false;\n\n        @Option(names = {\"-g\", \"--generate-docs\"}, description = \"Generate docs\")\n        private boolean generateDocs = false;\n    }\n\n    private static ServerConfiguration readBookieConfFile(String bookieConfigFile) throws IllegalArgumentException {\n        ServerConfiguration bookieConf = new ServerConfiguration();\n        try {\n            bookieConf.loadConf(new File(bookieConfigFile).toURI().toURL());\n            bookieConf.validate();\n            log.info().attr(\"file\", bookieConfigFile).log(\"Using bookie configuration file\");\n        } catch (MalformedURLException e) {\n            log.error().attr(\"file\", bookieConfigFile).exception(e).log(\"Could not open configuration file\");\n            throw new IllegalArgumentException(\"Could not open configuration file\");\n        } catch (ConfigurationException e) {\n            log.error().attr(\"file\", bookieConfigFile).exception(e).log(\"Malformed configuration file\");\n            throw new IllegalArgumentException(\"Malformed configuration file\");\n        }\n\n        if (bookieConf.getMaxPendingReadRequestPerThread() < bookieConf.getRereplicationEntryBatchSize()) {\n            throw new IllegalArgumentException(\n                \"rereplicationEntryBatchSize should be smaller than \" + \"maxPendingReadRequestPerThread\");\n        }\n        return bookieConf;\n    }\n\n    protected static class BrokerStarter implements Callable<Integer> {\n        private ServiceConfiguration brokerConfig;\n        private PulsarService pulsarService;\n        private LifecycleComponent bookieServer;\n        private volatile CompletableFuture<Void> bookieStartFuture;\n        private AutoRecoveryMain autoRecoveryMain;","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-broker/src/main/java/org/apache/pulsar/PulsarBrokerStarter.java#L99-L135","documentation":"PulsarBrokerStarter.readBookieConfFile loads the Bookie configuration file when the broker runs a bookie or bookie auto-recovery in the same process. A MalformedURLException while converting the file path to a URL (i.e. the file cannot be opened/resolved as a URL) is logged and rethrown as this IllegalArgumentException.","triggerScenarios":"Passing -bc/--bookieConfigFile whose path is malformed or unreadable; bookieConf.loadConf(new File(bookieConfigFile).toURI().toURL()) throws MalformedURLException.","commonSituations":"Typo in the --bookie-config path; file missing; using a directory instead of a file; relative path resolved against an unexpected working directory.","solutions":["Pass a valid, existing bookie configuration file path via --bookie-config/-bc","Verify the file exists and is readable by the broker user (run ls on the path)","Use an absolute path to avoid working-directory ambiguity"],"exampleFix":"// before\n./pulsar broker --bookie-config conf/bookie.conf\n// after\n./pulsar broker --bookie-config /pulsar/conf/bookie.conf","handlingStrategy":"validation","validationCode":"Path p = Paths.get(args.bookieConfigFile);\nif (args.bookieConfigFile == null || !Files.isRegularFile(p) || !Files.isReadable(p)) {\n    throw new IllegalArgumentException(\"Bookie config not a readable file: \" + p);\n}","typeGuard":null,"tryCatchPattern":"try {\n    BookKeeperConfiguration conf = readBookieConfFile(bookieConfigFile);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"Could not open\")) {\n        throw new IllegalStateException(\"Check --bookie-config path: \" + bookieConfigFile, e);\n    }\n    throw e;\n}","preventionTips":["Always pass absolute paths for --bookie-config","Verify file existence and permissions in deployment scripts before launch","Avoid symlinks to transient mounts"],"tags":["configuration","startup","io"],"backgroundTag":"config-file-unreadable","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"}