{"record":{"id":"0daa5431b7fae696","repo":"apache/cassandra","slug":"event-can-not-be-null-nor-blank-string","errorCode":null,"errorMessage":"Event can not be null nor blank string.","messagePattern":"Event can not be null nor blank string\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/AsyncProfilerService.java","lineNumber":172,"sourceCode":"        nativemem(\"nativemem\"),\n        cache_misses(\"cache-misses\");\n\n        private final String name;\n\n        AsyncProfilerEvent(String name)\n        {\n            this.name = name;\n        }\n\n        public String getEvent()\n        {\n            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    {","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/AsyncProfilerService.java#L154-L190","documentation":"AsyncProfilerService.parseEvents validates the raw event string for the async profiler. A null or blank (whitespace-only) string cannot name any profiler event, so an IllegalArgumentException is thrown before attempting enum parsing.","triggerScenarios":"Calling the async profiler start/stop API (nodetool asyncprofiler or JMX) with an events argument that is empty, null, or all whitespace, e.g. nodetool asyncprofiler \"\".","commonSituations":"Scripts interpolating an unset variable into the events parameter; passing empty quotes in a shell; config field left blank for profiler events.","solutions":["Pass a valid event name such as cpu, alloc, wall, or a comma combination like cpu,alloc","If the events argument is optional, omit it entirely rather than passing an empty string","Fix the script/config so the variable holding the event name is populated"],"exampleFix":"// before\nnodetool asyncprofiler \"$EVENTS\"  # EVENTS unset -> blank\n// after\nnodetool asyncprofiler cpu","handlingStrategy":"validation","validationCode":"if (rawEvents == null || rawEvents.isBlank())\n    throw new IllegalArgumentException(\"events required; e.g. cpu or cpu,alloc\");","typeGuard":null,"tryCatchPattern":"try { startProfiling(events, format); }\ncatch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"Event can not be null\")) startProfiling(\"cpu\", format); else throw e;\n}","preventionTips":["Default events to 'cpu' in scripts when unset instead of passing empty strings","Use ${EVENTS:-cpu} style defaults in shell wrappers"],"tags":["async-profiler","validation","blank-argument"],"backgroundTag":"empty-required-field","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"}