{"record":{"id":"45f42edcab9b0458","repo":"apache/pulsar","slug":"offloadedreadpriority-parameter-must-be-one-of","errorCode":null,"errorMessage":"--offloadedReadPriority parameter must be one of ${allowed} but got: ${value}","messagePattern":"--offloadedReadPriority parameter must be one of (.+?) but got: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-client-admin-api/src/main/java/org/apache/pulsar/common/policies/data/OffloadedReadPriority.java","lineNumber":62,"sourceCode":"    }\n\n    public boolean equalsName(String otherName) {\n        return value.equals(otherName);\n    }\n\n    @Override\n    public String toString() {\n        return value;\n    }\n\n    public static OffloadedReadPriority fromString(String str) {\n        for (OffloadedReadPriority value : OffloadedReadPriority.values()) {\n            if (value.value.equals(str)) {\n                return value;\n            }\n        }\n\n        throw new IllegalArgumentException(\"--offloadedReadPriority parameter must be one of \"\n                + Arrays.stream(OffloadedReadPriority.values())\n                .map(OffloadedReadPriority::toString)\n                .collect(Collectors.joining(\",\"))\n                + \" but got: \" + str);\n    }\n\n    public String getValue() {\n        return value;\n    }\n}","sourceCodeStart":44,"sourceCodeEnd":72,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-admin-api/src/main/java/org/apache/pulsar/common/policies/data/OffloadedReadPriority.java#L44-L72","documentation":"OffloadedReadPriority.fromString parses the --offloadedReadPriority value ('ledgers first' ordering variants like 'ledgerfirst'/'bookkeeperfirst') and throws IllegalArgumentException listing all allowed values when the input doesn't match any. It's a strict CLI/config value parser for tiered-storage read priority.","triggerScenarios":"Calling OffloadedReadPriority.fromString(str) with a misspelled, mis-cased, or empty string, e.g. 'LedgerFirst', 'ledger_first', or 'bookkeeper-first' instead of the exact allowed tokens.","commonSituations":"Typo in broker.conf or CLI flag --offloadedReadPriority, copying values from older docs where naming differed, environment-specific config templating producing empty strings.","solutions":["Use exactly one of the allowed values listed in the error message (e.g. ledgerfirst, bookkeeperfirst)","Check case and spacing: the comparison is exact (value.value.equals(str))","Copy the allowed list from the OffloadedReadPriority enum in the version you are deploying"],"exampleFix":"// before\n--offloadedReadPriority LedgerFirst\n// after\n--offloadedReadPriority ledgerfirst","handlingStrategy":"validation","validationCode":"boolean isValidOffloadedReadPriority(String s) {\n    return Arrays.stream(OffloadedReadPriority.values())\n        .anyMatch(p -> p.toString().equals(s));\n}","typeGuard":null,"tryCatchPattern":"try {\n    OffloadedReadPriority p = OffloadedReadPriority.fromString(value);\n} catch (IllegalArgumentException e) {\n    logger.error(\"Bad --offloadedReadPriority '{}': use one of ledgerfirst,bookkeeperfirst\", value);\n}","preventionTips":["Copy allowed values from the error message or the enum, never from memory","Watch exact case/spacing — matching is case-sensitive","Validate broker.conf values in config linting before deploy"],"tags":["enum","parsing","configuration","cli"],"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"}