alibaba/arthas · error · IllegalStateException
Cannot run proces in {} state
Error message
Cannot run proces in {} state What it means
Thrown by Process.run() when processStatus is not READY. A process can only transition from READY to RUNNING once; calling run() on an already-running, stopped, or terminated process is illegal. (Note: the message contains a typo 'proces'.) This guards against double-execution of a command process.
Source
Thrown at core/src/main/java/com/taobao/arthas/core/shell/system/impl/ProcessImpl.java:322
} finally {
if (completionHandler != null) {
completionHandler.handle(null);
}
if (terminatedHandler != null && statusUpdate == ExecStatus.TERMINATED) {
terminatedHandler.handle(exitCodeUpdate);
}
}
}
@Override
public void run() {
run(true);
}
@Override
public synchronized void run(boolean fg) {
if (processStatus != ExecStatus.READY) {
throw new IllegalStateException("Cannot run proces in " + processStatus + " state");
}
processStatus = ExecStatus.RUNNING;
processForeground = fg;
foreground = fg;
startTime = new Date();
// Make a local copy
final Tty tty = this.tty;
if (tty == null) {
throw new IllegalStateException("Cannot execute process without a TTY set");
}
process = new CommandProcessImpl(this, tty);
if (resultDistributor == null) {
resultDistributor = new TermResultDistributorImpl(process, ArthasBootstrap.getInstance().getResultViewResolver());
}
View on GitHub (pinned to 21cf2e9ba5)
Solutions
- Create a new Process/Job instance for each execution rather than re-running the same one.
- Guard run() with a status check to ensure the process is still READY.
Example fix
// before
process.run(); // may throw if already run
process.run();
// after: create a fresh process for re-execution
if (process.status() == ExecStatus.READY) {
process.run();
} else {
process = jobController.createJob(/* ... */);
process.run();
} Defensive patterns
Strategy: type-guard
Validate before calling
if (process.status() == ExecStatus.READY) {
process.run();
} else {
// create a new process for re-execution
} Type guard
boolean canRun(Process p) {
return p.status() == ExecStatus.READY;
} Try / catch
try {
process.run(fg);
} catch (IllegalStateException e) {
if (e.getMessage().contains("Cannot run proces")) {
// already started; create a new process if re-execution is needed
}
} Prevention
- Never call run() twice on the same Process instance.
- Create a fresh Process via JobController for each execution.
When it happens
Trigger: run() is invoked twice on the same Process instance, or a process that was previously run and terminated is submitted for execution again.
Common situations: A job scheduler or custom integration that retries run() after a failure without creating a fresh process. Concurrency bugs where two threads start the same process.
Related errors
- Cannot interrupt process in {} state
- Cannot resume process in {} state
- Cannot suspend process in {} state
- Cannot set to background a process in {} state
- Cannot set to foreground a process in {} state
AI-assisted analysis of alibaba/arthas@21cf2e9ba5 (2026-08-14).
Data as JSON: /api/errors/63c6644e727c7464.
Report an issue: GitHub.