{"record":{"id":"d120c1514f862f26","repo":"apache/cassandra","slug":"unhandled-return-type","errorCode":null,"errorMessage":"Unhandled return type: ","messagePattern":"Unhandled return type: ","errorType":"console","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tools/nodetool/GuardrailsConfigCommand.java","lineNumber":161,"sourceCode":"                Object value = method.invoke(mBean);\n\n                if (returnType.equals(int.class) || returnType.equals(Integer.class)\n                    || returnType.equals(long.class) || returnType.equals(Long.class)\n                    || returnType.equals(boolean.class) || returnType.equals(Boolean.class)\n                    || returnType.equals(Set.class))\n                {\n                    values.add(value.toString());\n                }\n                else if (returnType.equals(String.class))\n                {\n                    if (value == null || value.toString().isEmpty())\n                        values.add(\"null\");\n                    else\n                        values.add(value.toString());\n                }\n                else\n                {\n                    throw new RuntimeException(\"Unhandled return type: \" + returnType.getTypeName());\n                }\n            }\n\n            constructRow(bucket, guardrailName, values.size() == 1 ? values.get(0) : values.toString());\n        }\n    }\n\n    @Command(name = \"setguardrailsconfig\", description = \"Modify runtime configuration of guardrails.\")\n    public static class SetGuardrailsConfig extends GuardrailsConfigCommand\n    {\n        private static final Pattern SETTER_PATTERN = Pattern.compile(\"^set\");\n\n        @CassandraUsage(usage = \"[<setter> <value1> ...]\",\n                description = \"For flags, possible values are 'true' or 'false'. \" +\n                        \"For thresholds, two values are expected, first for failure, second for warning. \" +\n                        \"For values, enumeration of values expected or one value where multiple items are separated by comma. \" +\n                        \"Setting for thresholds accepting strings and value guardrails are reset by specifying 'null' or '[]' value. \" +\n                        \"For thresholds accepting integers, the reset value is -1.\")","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tools/nodetool/GuardrailsConfigCommand.java#L143-L179","documentation":"The guardrails-config display code can only render getter return types it knows (strings, numbers, booleans, collections); if a getter returns an unexpected type it throws RuntimeException 'Unhandled return type: <typeName>'. This signals a server/client version mismatch where the MBean exposes a new return type the nodetool formatter does not handle.","triggerScenarios":"Displaying a guardrail whose MBean getter returns a type not covered by addRow's if/else chain (e.g. a newly introduced custom type added to GuardrailsMBean in a newer release while using an older nodetool formatter, or vice versa).","commonSituations":"Mixed-version clusters where nodetool and the node run different Cassandra versions; newly added guardrails with novel return types.","solutions":["Use a nodetool version matching the server's Cassandra version.","Upgrade to a release where the return type is supported.","Query the guardrail value directly via JMX as a workaround."],"exampleFix":"// before\n# nodetool 4.0 against a 5.0 node with a new guardrail type\n// after\n# run the matching-version nodetool against the node","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    display(probe, allGetters, category, expand);\n} catch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"Unhandled return type:\")) {\n        System.err.println(\"Client/server version mismatch; use matching nodetool or query JMX directly.\");\n    } else throw e;\n}","preventionTips":["Run the nodetool version shipped with the server's Cassandra version.","Prefer JMX for newly added guardrails until your tooling supports them."],"tags":["cli","nodetool","guardrails","type-mismatch","version-skew"],"backgroundTag":"unsupported-operation","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}