{"record":{"id":"2a0fba26e6828519","repo":"apache/pulsar","slug":"metadata-store-address-argument-is-required-met","errorCode":null,"errorMessage":"Metadata store address argument is required (--metadata-store)","messagePattern":"Metadata store address argument is required \\(--metadata-store\\)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-broker/src/main/java/org/apache/pulsar/PulsarClusterMetadataTeardown.java","lineNumber":125,"sourceCode":"            commander.parseArgs(args);\n            if (arguments.help) {\n                commander.usage(commander.getOut());\n                return;\n            }\n            if (arguments.generateDocs) {\n                CmdGenerateDocs cmd = new CmdGenerateDocs(\"pulsar\");\n                cmd.addCommand(\"delete-cluster-metadata\", commander);\n                cmd.run(null);\n                return;\n            }\n        } catch (Exception e) {\n            commander.getErr().println(e);\n            throw e;\n        }\n\n        if (arguments.metadataStoreUrl == null && arguments.zookeeper == null) {\n            commander.usage(commander.getOut());\n            throw new IllegalArgumentException(\"Metadata store address argument is required (--metadata-store)\");\n        }\n\n        if (arguments.metadataStoreUrl == null) {\n            arguments.metadataStoreUrl = ZKMetadataStore.ZK_SCHEME_IDENTIFIER + arguments.zookeeper;\n        }\n\n        @Cleanup\n        MetadataStoreExtended metadataStore = MetadataStoreExtended.create(arguments.metadataStoreUrl,\n                MetadataStoreConfig.builder()\n                        .sessionTimeoutMillis(arguments.zkSessionTimeoutMillis)\n                        .metadataStoreName(MetadataStoreConfig.METADATA_STORE)\n                        .configFilePath(arguments.metadataStoreConfigPath)\n                        .build());\n\n        if (arguments.bkMetadataServiceUri != null) {\n            @Cleanup\n            BookKeeper bookKeeper =\n                    new BookKeeper(new ClientConfiguration().setMetadataServiceUri(arguments.bkMetadataServiceUri));","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-broker/src/main/java/org/apache/pulsar/PulsarClusterMetadataTeardown.java#L107-L143","documentation":"PulsarClusterMetadataTeardown wipes cluster metadata (ZooKeeper/metadata store contents) before removing the cluster. The tool needs the address of the metadata store to connect to; if neither --metadata-store nor the legacy --zookeeper argument is supplied, it aborts before doing anything. This is a fail-fast guard so the tool never connects to an unintended or default metadata service.","triggerScenarios":"Running `pulsar cluster-metadata-teardown` (main() via JCommander) without either: (a) the --metadata-store <url> argument, or (b) the legacy --zookeeper <host:port> argument. arguments.metadataStoreUrl == null && arguments.zookeeper == null in main().","commonSituations":"Following an old tutorial or script that only passed --zookeeper (removed/renamed in newer versions); running the teardown command with no arguments at all; copy-pasting a start command instead of the teardown command; automation scripts where the variable holding the URL is empty.","solutions":["Re-run with --metadata-store, e.g. `bin/pulsar cluster-metadata-teardown --metadata-store zookeeper://zk1:2181` (or the configured metadataStoreUrl from broker.conf).","If you are on an older ZooKeeper-based setup and still have the legacy flag available, pass `--zookeeper zk1:2181`; it is converted to a zookeeper:// metadata store URL automatically.","Check your automation/env so the URL variable is actually set (empty shell variables are a common silent cause).","Run with --help to see the exact accepted flags for your Pulsar version."],"exampleFix":"// before\nbin/pulsar cluster-metadata-teardown\n\n// after\nbin/pulsar cluster-metadata-teardown --metadata-store zookeeper://zk1:2181","handlingStrategy":"validation","validationCode":"String metadataStoreUrl = System.getProperty(\"pulsar.metadatastore.url\");\nif ((metadataStoreUrl == null || metadataStoreUrl.isEmpty())\n        && (zookeeperArg == null || zookeeperArg.isEmpty())) {\n    throw new IllegalArgumentException(\n        \"cluster-metadata-teardown requires --metadata-store or --zookeeper\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    teardown.main(args);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"--metadata-store\")) {\n        System.err.println(\"Usage: --metadata-store <scheme://host:port> (or legacy --zookeeper <host:port>)\");\n    }\n    throw e;\n}","preventionTips":["Always pass --metadata-store explicitly in scripts; never rely on legacy --zookeeper.","Source the metadata store URL from the broker.conf (metadataStoreUrl=...) rather than typing it.","Validate shell variables are non-empty before interpolating them into CLI args.","Run `pulsar cluster-metadata-teardown --help` when upgrading versions to catch flag renames."],"tags":["cli","configuration","missing-argument","metadata-store","zookeeper"],"backgroundTag":"missing-required-cli-argument","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"}