apache/cassandra · error · IllegalStateException

Async Profiler is not enabled. Enable it by setting

Error message

Async Profiler is not enabled. Enable it by setting ${ASYNC_PROFILER_ENABLED.getKey()} property to true.

What it means

All AsyncProfilerService operations (start, stop, execute, status) funnel through run(), which first checks the async_profiler_enabled config flag. If the feature is disabled, an IllegalStateException is thrown telling the user to enable the property.

Solutions

  1. Set async_profiler_enabled: true in cassandra.yaml (or the corresponding system property) and restart the node
  2. Re-run the profiling command after enabling
  3. If profiling is not intended, avoid calling the profiler endpoints

Example fix

// cassandra.yaml
// before
async_profiler_enabled: false
// after
async_profiler_enabled: true
Defensive patterns

Strategy: validation

Validate before calling

if (!DatabaseDescriptor.getRawConfig().async_profiler_enabled)
    throw new IllegalStateException("Enable async_profiler_enabled before calling the profiler service");
service.status();

Try / catch

try { service.start(params); } catch (IllegalStateException e) { if (e.getMessage().contains("not enabled")) { /* surface 'enable async_profiler_enabled' to operator */ } throw e; }

Prevention

When it happens

Trigger: Calling start, stop, execute, or status on AsyncProfilerService while the async_profiler_enabled config property is false (the default).

Common situations: Operators attempting nodetool profiling on a node where async profiler was never enabled at startup; containers launched without the config override.

Related errors


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

Appendix: source

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

    {
        if (!isEnabled())
            return false;

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

    private <T> T run(ThrowingFunction<AsyncProfiler, T> f)
    {
        if (!ASYNC_PROFILER_ENABLED.getBoolean())
            throw new IllegalStateException("Async Profiler is not enabled. Enable it by setting " + ASYNC_PROFILER_ENABLED.getKey() +
                                            " property to true.");
        if (asyncProfiler != null)
        {
            try
            {
                return f.apply(asyncProfiler);
            }
            catch (IllegalStateException | IllegalArgumentException t)
            {
                throw t;
            }
            catch (Throwable t)
            {
                throw new RuntimeException(t);
            }
        }
        else
            throw new IllegalStateException("Async profiler not available.");

View on GitHub (pinned to 88fd0f6a0e)