apache/pulsar · error · IllegalArgumentException

Need to specify a configuration file for broker

Error message

Need to specify a configuration file for broker

What it means

CLI bootstrap guard in CompactorTool.main: the --broker-config option was blank, and because the compactor tool runs embedded broker components it requires a valid broker.conf path to initialize; usage is printed and the tool exits instead of proceeding with no configuration.

Source

Thrown at pulsar-broker/src/main/java/org/apache/pulsar/compaction/CompactorTool.java:167

        CommandLine commander = new CommandLine(arguments);
        commander.setCommandName("PulsarTopicCompactor");
        commander.parseArgs(args);
        if (arguments.help) {
            commander.usage(commander.getOut());
            System.exit(0);
        }

        if (arguments.generateDocs) {
            CmdGenerateDocs cmd = new CmdGenerateDocs("pulsar");
            cmd.addCommand("compact-topic", arguments);
            cmd.run(null);
            System.exit(0);
        }

        // init broker config
        if (isBlank(arguments.brokerConfigFile)) {
            commander.usage(commander.getOut());
            throw new IllegalArgumentException("Need to specify a configuration file for broker");
        }

        final String filepath = Path.of(arguments.brokerConfigFile).toAbsolutePath().normalize().toString();
        log.info(String.format("read configuration file %s", filepath));
        final ServiceConfiguration brokerConfig =
                PulsarConfigurationLoader.create(filepath, ServiceConfiguration.class);

        if (isBlank(brokerConfig.getMetadataStoreUrl())) {
            final String message = String.format("""
                    Need to specify `metadataStoreUrl` or `zookeeperServers` in configuration file
                    or specify configuration file path from command line.
                    now configuration file path is=[%s]
                    """, filepath);
            throw new IllegalArgumentException(message);
        }

        @Cleanup(value = "shutdownNow")
        ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(

View on GitHub (pinned to 820761864e)

Solutions

  1. Pass -c/--broker-config pointing to a valid broker.conf
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pulsar-broker/src/main/java/org/apache/pulsar/compaction/CompactorTool.java:167 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/8b93082b9e23ce6a. Report an issue: GitHub.