{"record":{"id":"a0794b5713ebf95b","repo":"apache/pulsar","slug":"must-pass-one-of-the-params-bundle-bundle-t","errorCode":null,"errorMessage":"Must pass one of the params: --bundle / --bundle-type","messagePattern":"Must pass one of the params: --bundle / --bundle-type","errorType":"validation","errorClass":"ParameterException","httpStatus":null,"severity":"error","filePath":"pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java","lineNumber":940,"sourceCode":"                \"-u\" }, description = \"Unload newly split bundles after splitting old bundle\", required = false)\n        private boolean unload;\n\n        @Option(names = { \"--split-algorithm-name\", \"-san\" }, description = \"Algorithm name for split \"\n                + \"namespace bundle. Valid options are: [range_equally_divide, topic_count_equally_divide, \"\n                + \"specified_positions_divide, flow_or_qps_equally_divide]. Use broker side config if absent\"\n                , required = false)\n        private String splitAlgorithmName;\n\n        @Option(names = { \"--split-boundaries\",\n                \"-sb\" }, description = \"Specified split boundary for bundle split, will split one bundle \"\n                + \"to multi bundles only works with specified_positions_divide algorithm\", required = false)\n        private List<Long> splitBoundaries;\n\n        @Override\n        void run() throws PulsarAdminException {\n            String namespace = validateNamespace(namespaceName);\n            if (StringUtils.isBlank(bundle) && bundleType == null) {\n                throw new ParameterException(\"Must pass one of the params: --bundle / --bundle-type\");\n            }\n            if (StringUtils.isNotBlank(bundle) && bundleType != null) {\n                throw new ParameterException(\"--bundle and --bundle-type are mutually exclusive\");\n            }\n            bundle = bundleType != null ? bundleType.toString() : bundle;\n            if (splitBoundaries == null || splitBoundaries.size() == 0) {\n                getAdmin().namespaces().splitNamespaceBundle(\n                        namespace, bundle, unload, splitAlgorithmName);\n            } else {\n                getAdmin().namespaces().splitNamespaceBundle(\n                        namespace, bundle, unload, splitAlgorithmName, splitBoundaries);\n            }\n        }\n    }\n\n    @Command(description = \"Get the positions for one or more topic(s) in a namespace bundle\")\n    private class GetTopicHashPositions extends CliCommand {\n        @Parameters(description = \"tenant/namespace\", arity = \"1\")","sourceCodeStart":922,"sourceCodeEnd":958,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java#L922-L958","documentation":"The splitNamespaceBundle CLI command requires you to identify the bundle to split either by explicit bundle range (--bundle, e.g. 0x00000000_0xffffffff) or by bundle type (--bundle-type, e.g. largest/Range). If neither is provided the CLI fails fast with this ParameterException instead of guessing a bundle.","triggerScenarios":"Running `pulsar-admin namespaces split-bundle <namespace>` (or calling the command's run()) with both the bundle field blank and bundleType null: StringUtils.isBlank(bundle) && bundleType == null.","commonSituations":"Operators forgetting that split-bundle needs a target bundle; older scripts written before --bundle-type existed that were also missing --bundle; interactive users assuming the command splits all bundles.","solutions":["Pass --bundle <bundle-range> (e.g. --bundle '0x00000000_0xffffffff'), or","Pass --bundle-type (e.g. --bundle-type largest) to let the CLI pick a bundle","Do not pass both at once (mutually exclusive, see error 872)"],"exampleFix":"// before\npulsar-admin namespaces split-bundle my-tenant/my-ns\n// after\npulsar-admin namespaces split-bundle my-tenant/my-ns --bundle '0x00000000_0xffffffff'","handlingStrategy":"validation","validationCode":"// shell guard\nif [ -z \"$BUNDLE\" ] && [ -z \"$BUNDLE_TYPE\" ]; then\n  echo \"Provide --bundle or --bundle-type\" >&2; exit 1;\nfi","typeGuard":"// pseudo: ensure exactly one bundle selector is present\nboolean hasBundle = bundle != null && !bundle.isBlank();\nif (!hasBundle && bundleType == null) throw new IllegalArgumentException(\"--bundle or --bundle-type required\");","tryCatchPattern":"try {\n    admin.namespaces().splitNamespaceBundle(ns, bundle, unload, algorithm);\n} catch (IllegalArgumentException e) {\n    // re-run after resolving the bundle via get-bundles\n}","preventionTips":["Always resolve the target bundle first with `namespaces get-bundles`","Prefer --bundle-type largest when you don't know ranges","Keep bundle-selection flags in one place in automation templates"],"tags":["cli","parameter-validation","pulsar-admin","bundle-splitting"],"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"}