alibaba/arthas · error · IllegalStateException

Cannot resume process in {} state

Error message

Cannot resume process in {} state

What it means

Thrown by Process.resume() when the process is not in the STOPPED state. Resume is only valid for a process that was previously suspended, transitioning it back to RUNNING. Calling resume on a READY, RUNNING, or TERMINATED process is a state-machine violation.

Source

Thrown at core/src/main/java/com/taobao/arthas/core/shell/system/impl/ProcessImpl.java:183

    @Override
    public void resume(boolean foreground) {
        resume(foreground, null);
    }

    @Override
    public void resume(Handler<Void> completionHandler) {
        resume(true, completionHandler);
    }

    @Override
    public synchronized void resume(boolean fg, Handler<Void> completionHandler) {
        if (processStatus == ExecStatus.STOPPED) {
            updateStatus(ExecStatus.RUNNING, null, fg, resumeHandler, terminatedHandler, completionHandler);
            if (process != null) {
                process.resume();
            }
        } else {
            throw new IllegalStateException("Cannot resume process in " + processStatus + " state");
        }
    }

    @Override
    public void suspend() {
        suspend(null);
    }

    @Override
    public synchronized void suspend(Handler<Void> completionHandler) {
        if (processStatus == ExecStatus.RUNNING) {
            updateStatus(ExecStatus.STOPPED, null, false, suspendHandler, terminatedHandler, completionHandler);
            if (process != null) {
                process.suspend();
            }
        } else {
            throw new IllegalStateException("Cannot suspend process in " + processStatus + " state");
        }

View on GitHub (pinned to 21cf2e9ba5)

Solutions

  1. Only resume a job whose status is STOPPED — check with 'jobs' first.
  2. If the job is TERMINATED, it cannot be resumed; restart the command instead.

Example fix

// before
job.process().resume();

// after
if (job.process().status() == ExecStatus.STOPPED) {
    job.process().resume();
}
Defensive patterns

Strategy: type-guard

Validate before calling

if (process.status() == ExecStatus.STOPPED) {
    process.resume();
}

Type guard

boolean canResume(Process p) {
    return p.status() == ExecStatus.STOPPED;
}

Try / catch

try {
    process.resume();
} catch (IllegalStateException e) {
    if (e.getMessage().contains("Cannot resume")) {
        // not suspended; no-op
    }
}

Prevention

When it happens

Trigger: Calling 'fg' or 'bg' (which internally resume) on a job that is running normally or already terminated. Resuming a job that was never suspended.

Common situations: User issues 'fg <jobId>' on a job that is already in the foreground/running. Scripted job control that doesn't track suspend state.

Related errors


AI-assisted analysis of alibaba/arthas@21cf2e9ba5 (2026-08-14). Data as JSON: /api/errors/68d52700ab94c002. Report an issue: GitHub.