{"record":{"id":"2802e3613bc9a7e7","repo":"apache/pulsar","slug":"config-file-not-specified-please-use-c-config","errorCode":null,"errorMessage":"Config file not specified. Please use -c, --config-file or -Dpulsar.config.file to specify the config file.","messagePattern":"Config file not specified\\. Please use -c, --config-file or -Dpulsar\\.config\\.file to specify the config file\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandaloneStarter.java","lineNumber":61,"sourceCode":"    private boolean generateDocs = false;\n    private Thread shutdownThread;\n    @Setter(AccessLevel.PACKAGE)\n    private boolean testMode;\n\n    public PulsarStandaloneStarter(String[] args) throws Exception {\n\n        CommandLine commander = new CommandLine(this);\n\n        try {\n            commander.parseArgs(args);\n            if (this.isHelp()) {\n                commander.usage(commander.getOut());\n                exit(0);\n            }\n            if (Strings.isNullOrEmpty(this.getConfigFile())) {\n                String configFile = System.getProperty(PULSAR_CONFIG_FILE);\n                if (Strings.isNullOrEmpty(configFile)) {\n                    throw new IllegalArgumentException(\n                            \"Config file not specified. Please use -c, --config-file or -Dpulsar.config.file to \"\n                                    + \"specify the config file.\");\n                }\n                this.setConfigFile(configFile);\n            }\n            if (this.generateDocs) {\n                CmdGenerateDocs cmd = new CmdGenerateDocs(\"pulsar\");\n                cmd.addCommand(\"standalone\", this);\n                cmd.run(null);\n                exit(0);\n            }\n\n            if (this.isNoBroker() && this.isOnlyBroker()) {\n                log.error(\"Only one option is allowed between '--no-broker' and '--only-broker'\");\n                commander.usage(commander.getOut());\n                return;\n            }\n        } catch (Exception e) {","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandaloneStarter.java#L43-L79","documentation":"PulsarStandaloneStarter boots Pulsar in standalone mode from a broker/service configuration file. Before parsing that file it checks that a config file path was supplied, either via the -c/--config-file command-line option or via the -Dpulsar.config.file system property. If both are empty, it refuses to start with a sensible message instead of failing later with a confusing parse error.","triggerScenarios":"Starting the standalone service (`bin/pulsar standalone ...` with PulsarStandaloneStarter as main class) without -c/--config-file and without -Dpulsar.config.file=... set in the JVM properties. getConfigFile() returns null/empty and System.getProperty(PULSAR_CONFIG_FILE) (\"pulsar.config.file\") is also null/empty.","commonSituations":"Running the standalone jar directly with `java -jar` and forgetting the JVM property; IDE run configurations that omit program arguments; Kubernetes/Docker entrypoints where the -c flag was dropped; upgrading a script that previously relied on an implicit default config.","solutions":["Pass the config explicitly: `bin/pulsar standalone --config-loader-... ` — for the starter: `java -cp ... org.apache.pulsar.PulsarStandaloneStarter -c conf/standalone.conf` (or `--config-file conf/standalone.conf`).","Or set the system property instead of the flag: `java -Dpulsar.config.file=conf/standalone.conf ...`.","If using bin/pulsar wrapper scripts, ensure arguments are actually forwarded (quoting issues can silently drop -c).","Verify the config file path exists and is readable so the next startup step succeeds."],"exampleFix":"// before\njava -jar pulsar.jar standalone\n\n// after\njava -Dpulsar.config.file=conf/standalone.conf -jar pulsar.jar standalone\n// or: java -jar pulsar.jar standalone -c conf/standalone.conf","handlingStrategy":"validation","validationCode":"String configFile = System.getProperty(\"pulsar.config.file\");\nif (configFile == null || configFile.isEmpty()) {\n    configFile = args.length > 0 && \"-c\".equals(args[0]) ? args[1] : null;\n}\nif (configFile == null) {\n    throw new IllegalStateException(\"Pass -c/--config-file or -Dpulsar.config.file before starting standalone\");\n}\nif (!java.nio.file.Files.isRegularFile(java.nio.file.Path.of(configFile))) {\n    throw new IllegalStateException(\"Config file does not exist: \" + configFile);\n}","typeGuard":null,"tryCatchPattern":"try {\n    starter.main(args);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Config file not specified\")) {\n        System.err.println(\"Start with: -c <path-to-standalone.conf> or -Dpulsar.config.file=<path>\");\n    }\n    throw e;\n}","preventionTips":["Always start via bin/pulsar standalone rather than invoking the starter main class directly so default config handling applies.","In IDE run configurations and Docker CMD/ENTRYPOINT, explicitly include -c conf/standalone.conf.","Verify the JVM property -Dpulsar.config.file is set before -jar/-cp in the command line (order matters).","Check the file exists and is readable from the working directory before launch."],"tags":["cli","configuration","missing-config-file","standalone","startup"],"backgroundTag":"missing-config-file","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"}