{"record":{"id":"abce805de3101a4a","repo":"apache/pulsar","slug":"bundle-and-bundle-type-are-mutually-exclusive","errorCode":null,"errorMessage":"--bundle and --bundle-type are mutually exclusive","messagePattern":"--bundle and --bundle-type are mutually exclusive","errorType":"validation","errorClass":"ParameterException","httpStatus":null,"severity":"error","filePath":"pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java","lineNumber":943,"sourceCode":"        @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\")\n        private String namespaceName;\n\n        @Option(","sourceCodeStart":925,"sourceCodeEnd":961,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java#L925-L961","documentation":"The splitNamespaceBundle command accepts the bundle either as an explicit range via --bundle or symbolically via --bundle-type, never both. Passing both is ambiguous, so the CLI throws this ParameterException.","triggerScenarios":"Running split-bundle with both a non-blank --bundle value and a --bundle-type value: StringUtils.isNotBlank(bundle) && bundleType != null.","commonSituations":"Scripts built up incrementally that kept --bundle and later added --bundle-type; copy-pasted command lines merging two variants of the same command.","solutions":["Remove --bundle and rely on --bundle-type, or","Remove --bundle-type and specify the explicit --bundle range"],"exampleFix":"// before\npulsar-admin namespaces split-bundle my-tenant/my-ns --bundle '0x00000000_0xffffffff' --bundle-type largest\n// after\npulsar-admin namespaces split-bundle my-tenant/my-ns --bundle '0x00000000_0xffffffff'","handlingStrategy":"validation","validationCode":"// shell guard\nif [ -n \"$BUNDLE\" ] && [ -n \"$BUNDLE_TYPE\" ]; then\n  echo \"--bundle and --bundle-type are mutually exclusive\" >&2; exit 1;\nfi","typeGuard":"// pseudo: require exclusive bundle selectors\nint selectors = ((bundle != null && !bundle.isBlank()) ? 1 : 0) + (bundleType != null ? 1 : 0);\nif (selectors != 1) throw new IllegalArgumentException(\"exactly one of --bundle / --bundle-type\");","tryCatchPattern":"try {\n    admin.namespaces().splitNamespaceBundle(ns, bundle, unload, algorithm);\n} catch (IllegalArgumentException e) {\n    // strip the redundant flag and retry\n}","preventionTips":["Choose one selection mode per command line","Remove hardcoded --bundle from templates that also inject --bundle-type","Lint admin command lines for duplicate selectors"],"tags":["cli","parameter-validation","pulsar-admin","conflicting-options"],"backgroundTag":"mutually-exclusive-cli-flags","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}