{"record":{"id":"bea66ae81303e2ca","repo":"apache/pulsar","slug":"offloadedreadpriority-parameter-must-be-one-of-bea66a","errorCode":null,"errorMessage":"--offloadedReadPriority parameter must be one of %s but got: %s","messagePattern":"--offloadedReadPriority parameter must be one of (.+?) but got: (.+?)","errorType":"validation","errorClass":"ParameterException","httpStatus":null,"severity":"error","filePath":"pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java","lineNumber":2361,"sourceCode":"            String namespace = validateNamespace(namespaceName);\n\n            if (!driverSupported(driver)) {\n                throw new ParameterException(\"The driver \" + driver + \" is not supported, \"\n                        + \"(Possible values: \" + String.join(\",\", driverNames) + \").\");\n            }\n\n            if (isS3Driver(driver) && Strings.isNullOrEmpty(region) && Strings.isNullOrEmpty(endpoint)) {\n                throw new ParameterException(\n                        \"Either s3ManagedLedgerOffloadRegion or s3ManagedLedgerOffloadServiceEndpoint must be set\"\n                                + \" if s3 offload enabled\");\n            }\n\n            OffloadedReadPriority offloadedReadPriority = OffloadPoliciesImpl.DEFAULT_OFFLOADED_READ_PRIORITY;\n            if (this.offloadReadPriorityStr != null) {\n                try {\n                    offloadedReadPriority = OffloadedReadPriority.fromString(this.offloadReadPriorityStr);\n                } catch (Exception e) {\n                    throw new ParameterException(\"--offloadedReadPriority parameter must be one of \"\n                            + Arrays.stream(OffloadedReadPriority.values())\n                            .map(OffloadedReadPriority::toString)\n                            .collect(Collectors.joining(\",\"))\n                            + \" but got: \" + this.offloadReadPriorityStr, e);\n                }\n            }\n\n            OffloadPolicies offloadPolicies = OffloadPoliciesImpl.create(driver, region, bucket, endpoint,\n                    s3Role, s3RoleSessionName,\n                    awsId, awsSecret,\n                    maxBlockSizeInBytes, readBufferSizeInBytes, offloadAfterThresholdInBytes,\n                    offloadThresholdInSeconds, offloadAfterElapsedInMillis, offloadedReadPriority);\n\n            getAdmin().namespaces().setOffloadPolicies(namespace, offloadPolicies);\n        }\n    }\n\n    @Command(description = \"Remove the offload policies for a namespace\")","sourceCodeStart":2343,"sourceCodeEnd":2379,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java#L2343-L2379","documentation":"The --offloadedReadPriority option for set-offload-policies only accepts the enumerated values of OffloadedReadPriority (currently 'first' meaning read from offloaded storage first, or 'last'). Any other string fails OffloadedReadPriority.fromString and is wrapped in a ParameterException listing the valid values.","triggerScenarios":"Running `pulsar-admin namespaces set-offload-policies --offloadedReadPriority <value>` where <value> is not exactly one of the enum constants, e.g. misspellings like 'First', 'reader-first', or 'tiered'.","commonSituations":"Typo or casing mistake in the enum name; copying option values from documentation of a different Pulsar version where the enum had different members; shell completion inserting a wrong value.","solutions":["Use one of the exact values printed in the message, e.g. --offloadedReadPriority first or --offloadedReadPriority last","Check the OffloadedReadPriority enum in your Pulsar version for the exact accepted strings","Omit --offloadedReadPriority entirely to use the default read priority"],"exampleFix":"// before\npulsar-admin namespaces set-offload-policies --driver s3 --bucket b --offloadedReadPriority reader-first\n// after\npulsar-admin namespaces set-offload-policies --driver s3 --bucket b --offloadedReadPriority first","handlingStrategy":"validation","validationCode":"Set<String> valid = Set.of(\"first\", \"last\");\nif (offloadReadPriority != null && !valid.contains(offloadReadPriority)) {\n    throw new IllegalArgumentException(\"--offloadedReadPriority must be one of \" + valid);\n}","typeGuard":null,"tryCatchPattern":"try {\n    OffloadedReadPriority p = OffloadedReadPriority.fromString(value);\n} catch (IllegalArgumentException e) {\n    // fall back to default read priority\n}","preventionTips":["Copy enum values exactly, lowercase, from the error message","Check the OffloadedReadPriority enum for your Pulsar version","Prefer omitting the flag to use the default"],"tags":["cli","validation","enum","configuration"],"backgroundTag":"invalid-enum-value","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"}