apache/cassandra · error · IllegalArgumentException

Event can not be null nor blank string.

Error message

Event can not be null nor blank string.

What it means

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.

Source

Thrown at src/java/org/apache/cassandra/service/AsyncProfilerService.java:172

        nativemem("nativemem"),
        cache_misses("cache-misses");

        private final String name;

        AsyncProfilerEvent(String name)
        {
            this.name = name;
        }

        public String getEvent()
        {
            return name;
        }

        public static String parseEvents(String rawString)
        {
            if (rawString == null || rawString.isBlank())
                throw new IllegalArgumentException("Event can not be null nor blank string.");

            try
            {
                List<String> processedEvents = new ArrayList<>();
                for (String rawEvent : rawString.split(","))
                    processedEvents.add(AsyncProfilerEvent.valueOf(rawEvent).getEvent());

                return String.join(",", processedEvents);
            }
            catch (IllegalArgumentException ex)
            {
                throw new IllegalArgumentException(format("Event must be one or a combination of %s", VALID_EVENTS));
            }
        }
    }

    public enum AsyncProfilerFormat
    {

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Pass a valid event name such as cpu, alloc, wall, or a comma combination like cpu,alloc
  2. If the events argument is optional, omit it entirely rather than passing an empty string
  3. Fix the script/config so the variable holding the event name is populated

Example fix

// before
nodetool asyncprofiler "$EVENTS"  # EVENTS unset -> blank
// after
nodetool asyncprofiler cpu
Defensive patterns

Strategy: validation

Validate before calling

if (rawEvents == null || rawEvents.isBlank())
    throw new IllegalArgumentException("events required; e.g. cpu or cpu,alloc");

Try / catch

try { startProfiling(events, format); }
catch (IllegalArgumentException e) {
    if (e.getMessage().contains("Event can not be null")) startProfiling("cpu", format); else throw e;
}

Prevention

When it happens

Trigger: 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 "".

Common situations: Scripts interpolating an unset variable into the events parameter; passing empty quotes in a shell; config field left blank for profiler events.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/0daa5431b7fae696. Report an issue: GitHub.