{"record":{"id":"bf952792881db78d","repo":"apache/pulsar","slug":"unable-to-parse-primary-parameter-list","errorCode":null,"errorMessage":"unable to parse primary parameter list: ","messagePattern":"unable to parse primary parameter list: ","errorType":"validation","errorClass":"ParameterException","httpStatus":null,"severity":"error","filePath":"pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaceIsolationPolicy.java","lineNumber":191,"sourceCode":"                .collect(Collectors.toList());\n    }\n\n    private NamespaceIsolationData createNamespaceIsolationData(List<String> namespaces,\n                                                                List<String> primary,\n                                                                List<String> secondary,\n                                                                String autoFailoverPolicyTypeName,\n                                                                Map<String, String> autoFailoverPolicyParams,\n                                                                NamespaceIsolationPolicyUnloadScope unload) {\n\n        // validate\n        namespaces = validateList(namespaces);\n        if (namespaces.isEmpty()) {\n            throw new ParameterException(\"unable to parse namespaces parameter list: \" + namespaces);\n        }\n\n        primary = validateList(primary);\n        if (primary.isEmpty()) {\n            throw new ParameterException(\"unable to parse primary parameter list: \" + namespaces);\n        }\n\n        secondary = validateList(secondary);\n\n        // System.out.println(\"namespaces = \" + namespaces);\n        // System.out.println(\"primary = \" + primary);\n        // System.out.println(\"secondary = \" + secondary);\n        // System.out.println(\"autoFailoverPolicyTypeName = \" + autoFailoverPolicyTypeName);\n        // System.out.println(\"autoFailoverPolicyParams = \" + autoFailoverPolicyParams);\n\n        NamespaceIsolationData.Builder nsIsolationDataBuilder = NamespaceIsolationData.builder();\n\n        if (namespaces != null) {\n            nsIsolationDataBuilder.namespaces(namespaces);\n        }\n\n        if (primary != null) {\n            nsIsolationDataBuilder.primary(primary);","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaceIsolationPolicy.java#L173-L209","documentation":"Thrown by createNamespaceIsolationData when the --primary option parses to an empty list. Note the message bug: it appends `namespaces` instead of `primary`. A namespace isolation policy must designate at least one primary broker regex, so empty input is rejected as a JCommander ParameterException before contacting the broker.","triggerScenarios":"Running `pulsar-admin namespaces-isolation-policy create` with --primary omitted or supplied as empty string / only commas, after --namespaces already passed validation.","commonSituations":"Forgetting the --primary flag because it seems optional; shell variable holding the primary regex list is empty; quoting strips the regex (special characters like [ ] interpreted by shell) leaving an empty value.","solutions":["Pass at least one primary broker regex, e.g. --primary 'broker-rack1.*'","Quote the regex so the shell does not expand bracket/glob characters to nothing: --primary 'my-cluster-broker[0-9]+'","Verify the shell variable holding the primary list is populated","If multiple primaries are needed use a comma-separated list"],"exampleFix":"// before\npulsar-admin ns-isolation-policy create p1 --namespaces 't/ns.*' --primary '' ...\n// after\npulsar-admin ns-isolation-policy create p1 --namespaces 't/ns.*' --primary 'broker-rack1[0-9]*' ...","handlingStrategy":"validation","validationCode":"if [ -z \"$PRIMARY_REGEX\" ]; then echo \"--primary must contain at least one broker regex\" >&2; exit 1; fi","typeGuard":null,"tryCatchPattern":"try { createNamespaceIsolationData(...); } catch (ParameterException e) { /* invalid input; fix args, no retry */ }","preventionTips":["Always pass --primary with at least one broker regex","Single-quote regex values so brackets are not glob-expanded","Note the message incorrectly echoes the namespaces list; verify your --primary flag even if the message mentions namespaces"],"tags":["cli","argument-validation","pulsar-admin"],"backgroundTag":"invalid-cli-arguments","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"}