apache/cassandra · error · IllegalArgumentException

Wrong parameters passed to stop async profiler method…

Error message

Wrong parameters passed to stop async profiler method. Passed parameters should be: ${ASYNC_PROFILER_STOP_PARAMS}

What it means

AsyncProfilerService.stop validates that the parameter map for stopping the profiler contains only keys from the allowed ASYNC_PROFILER_STOP_PARAMS set (containsAll, so extra unknown keys are rejected). If any parameter key is not in the allowed set, an IllegalArgumentException is thrown.

Solutions

  1. Pass only parameters listed in ASYNC_PROFILER_STOP_PARAMS (an empty map is typically valid since containsAll accepts it)
  2. Remove start-specific options from the stop call
  3. Verify accepted stop parameters for your Cassandra version

Example fix

// before
service.stop(Map.of("event", "cpu"));
// after
service.stop(Map.of());
Defensive patterns

Strategy: validation

Validate before calling

if (!AsyncProfilerService.ASYNC_PROFILER_STOP_PARAMS.containsAll(params.keySet()))
    throw new IllegalArgumentException("stop params must be a subset of " + AsyncProfilerService.ASYNC_PROFILER_STOP_PARAMS);
service.stop(params);

Try / catch

try { service.stop(params); } catch (IllegalArgumentException e) { logger.warn("Bad profiler stop params: {}", e.getMessage()); }

Prevention

When it happens

Trigger: Calling AsyncProfilerService.stop with a Map<String,String> containing a key not present in ASYNC_PROFILER_STOP_PARAMS, e.g. passing start-only options like 'event' to stop.

Common situations: Reusing the same options map for start and stop calls; typos in stop parameters; clients built against an older parameter list.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

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

        {
            throw new RuntimeException("Unable to create directory " + logDir);
        }
    }

    private void validateStartParameters(Map<String, String> parameters)
    {
        if (!ASYNC_PROFILER_START_PARAMS.equals(parameters.keySet()))
        {
            throw new IllegalArgumentException("Wrong parameters passed to start async profiler method. Passed parameters" +
                                               " should be: " + ASYNC_PROFILER_START_PARAMS);
        }
    }

    private void validateStopParameters(Map<String, String> parameters)
    {
        if (!ASYNC_PROFILER_STOP_PARAMS.containsAll(parameters.keySet()))
        {
            throw new IllegalArgumentException("Wrong parameters passed to stop async profiler method. Passed parameters" +
                                               " should be: " + ASYNC_PROFILER_STOP_PARAMS);
        }
    }

    private boolean isRunning()
    {
        if (!isEnabled())
            return false;

        try
        {
            String status = status();
            return status != null && status.contains("Profiling is running");
        }
        catch (Throwable t)
        {
            throw new RuntimeException(t);
        }

View on GitHub (pinned to 88fd0f6a0e)