{"record":{"id":"4bc9ba1cb623ddd3","repo":"apache/cassandra","slug":"must-be-one-of-values","errorCode":null,"errorMessage":"Must be one of ${values}","messagePattern":"Must be one of (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/concurrent/Stage.java","lineNumber":120,"sourceCode":"\n        try\n        {\n            return valueOf(upperStageName);\n        }\n        catch (IllegalArgumentException e)\n        {\n            switch(upperStageName) // Handle discrepancy between configuration file and stage names\n            {\n                case \"CONCURRENT_READS\":\n                    return READ;\n                case \"CONCURRENT_WRITERS\":\n                    return MUTATION;\n                case \"CONCURRENT_COUNTER_WRITES\":\n                    return COUNTER_MUTATION;\n                case \"CONCURRENT_MATERIALIZED_VIEW_WRITES\":\n                    return VIEW_MUTATION;\n                default:\n                    throw new IllegalStateException(\"Must be one of \" + Arrays.stream(values())\n                                                                              .map(Enum::toString)\n                                                                              .collect(Collectors.joining(\",\")));\n            }\n        }\n    }\n\n    // Convenience functions to execute on this stage\n    public void execute(Runnable task) { executor().execute(task); }\n    public void execute(ExecutorLocals locals, Runnable task) { executor().execute(locals, task); }\n    public void maybeExecuteImmediately(Runnable task) { executor().maybeExecuteImmediately(task); }\n    public <T> Future<T> submit(Callable<T> task) { return executor().submit(task); }\n    public Future<?> submit(Runnable task) { return executor().submit(task); }\n    public <T> Future<T> submit(Runnable task, T result) { return executor().submit(task, result); }\n\n    public ExecutorPlus executor()\n    {\n        if (executor == null)\n        {","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/concurrent/Stage.java#L102-L138","documentation":"Thrown by Stage.fromPoolName when a string does not match any known Cassandra internal stage pool name. The library only maps exact uppercase pool names (e.g. CONCURRENT_MUTATIONS, CONCURRENT_COUNTER_WRITES, CONCURRENT_MATERIALIZED_VIEW_WRITES) to Stage enum constants; anything else is rejected with an IllegalStateException listing all valid values.","triggerScenarios":"Calling Stage.fromPoolName with a string that is not an exact registered pool name, including wrong case (e.g. 'mutation' instead of 'MUTATION') or names from newer/older Cassandra versions.","commonSituations":"Parsing thread pool names from JMX or logs to Stages, tools that map executor names after a Cassandra version upgrade renamed or added stages, hand-written MBean automation with a typo.","solutions":["Check the string matches a valid stage pool name exactly (case-sensitive) as listed in the exception message","Print the valid values from Stage.values() before mapping to discover the correct spelling","Handle unknown names explicitly with a default mapping instead of relying on fromPoolName","If the name comes from another node, verify both nodes run the same Cassandra version"],"exampleFix":"// before\nStage stage = Stage.fromPoolName(jmxPoolName);\n// after\nStage stage = Arrays.stream(Stage.values())\n    .filter(s -> s.getJmxName().equalsIgnoreCase(jmxPoolName))\n    .findFirst()\n    .orElseThrow(() -> new IllegalArgumentException(\"Unknown pool: \" + jmxPoolName));","handlingStrategy":"validation","validationCode":"boolean isValidStage(String name) {\n    return Arrays.stream(Stage.values())\n        .anyMatch(s -> s.name().equals(name));\n}","typeGuard":"Stage asStage(String name) {\n    try { return Stage.fromPoolName(name); }\n    catch (IllegalStateException e) { return null; }\n}","tryCatchPattern":null,"preventionTips":["Compare pool names case-sensitively against Stage enum constants","Derive names from Stage.values() rather than hardcoding strings","Re-check stage lists after Cassandra version upgrades"],"tags":["concurrency","configuration","enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}