{"record":{"id":"2ee6a0b3b6913f35","repo":"apache/cassandra","slug":"event-must-be-one-or-a-combination-of-s","errorCode":null,"errorMessage":"Event must be one or a combination of %s","messagePattern":"Event must be one or a combination of (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/AsyncProfilerService.java","lineNumber":184,"sourceCode":"            return name;\n        }\n\n        public static String parseEvents(String rawString)\n        {\n            if (rawString == null || rawString.isBlank())\n                throw new IllegalArgumentException(\"Event can not be null nor blank string.\");\n\n            try\n            {\n                List<String> processedEvents = new ArrayList<>();\n                for (String rawEvent : rawString.split(\",\"))\n                    processedEvents.add(AsyncProfilerEvent.valueOf(rawEvent).getEvent());\n\n                return String.join(\",\", processedEvents);\n            }\n            catch (IllegalArgumentException ex)\n            {\n                throw new IllegalArgumentException(format(\"Event must be one or a combination of %s\", VALID_EVENTS));\n            }\n        }\n    }\n\n    public enum AsyncProfilerFormat\n    {\n        flat, traces, collapsed, flamegraph, tree, jfr;\n\n        public static String parseFormat(String rawFormat)\n        {\n            if (rawFormat == null || rawFormat.isBlank())\n                throw new IllegalArgumentException(\"Event can not be null nor blank string.\");\n\n            try\n            {\n                return AsyncProfilerFormat.valueOf(rawFormat).name();\n            }\n            catch (IllegalArgumentException ex)","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/AsyncProfilerService.java#L166-L202","documentation":"After null/blank validation, parseEvents attempts AsyncProfilerEvent.valueOf on each comma-separated token. Any token that is not a known event name produces an IllegalArgumentException, which is rethrown with a message listing all valid events, discarding the original detail.","triggerScenarios":"Passing an unknown or misspelled event (e.g. 'cpo' instead of 'cpu', or 'memory' instead of 'alloc') to the async profiler events parameter, including case mismatches since valueOf is case-sensitive.","commonSituations":"Copying event names from async-profiler documentation (which uses different names than the AsyncProfilerEvent enum); forgetting that combinations are comma-separated and case-sensitive.","solutions":["Use one of the valid event names exactly as listed in the error message (e.g. cpu, alloc, wall)","Check the AsyncProfilerEvent enum for accepted names and spelling/case","Join multiple events with commas: cpu,alloc"],"exampleFix":"// before\nnodetool asyncprofiler heap\n// after\nnodetool asyncprofiler alloc","handlingStrategy":"validation","validationCode":"Set<String> VALID = Set.of(\"cpu\",\"alloc\",\"wall\",\"lock\",\"cache\",\"itimer\");\nfor (String t : rawEvents.split(\",\"))\n    if (!VALID.contains(t)) throw new IllegalArgumentException(\"bad event: \" + t);","typeGuard":null,"tryCatchPattern":"try { startProfiling(events, format); }\ncatch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Event must be one or a combination\"))\n        startProfiling(\"cpu\", format); else throw e;\n}","preventionTips":["Check the AsyncProfilerEvent enum for the exact accepted names rather than async-profiler docs","Remember enum parsing is case-sensitive; keep event names lowercase as defined"],"tags":["async-profiler","enum","validation"],"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"}