{"record":{"id":"68d52700ab94c002","repo":"alibaba/arthas","slug":"cannot-resume-process-in-state","errorCode":null,"errorMessage":"Cannot resume process in {} state","messagePattern":"Cannot resume process in (.+?) state","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/com/taobao/arthas/core/shell/system/impl/ProcessImpl.java","lineNumber":183,"sourceCode":"    @Override\n    public void resume(boolean foreground) {\n        resume(foreground, null);\n    }\n\n    @Override\n    public void resume(Handler<Void> completionHandler) {\n        resume(true, completionHandler);\n    }\n\n    @Override\n    public synchronized void resume(boolean fg, Handler<Void> completionHandler) {\n        if (processStatus == ExecStatus.STOPPED) {\n            updateStatus(ExecStatus.RUNNING, null, fg, resumeHandler, terminatedHandler, completionHandler);\n            if (process != null) {\n                process.resume();\n            }\n        } else {\n            throw new IllegalStateException(\"Cannot resume process in \" + processStatus + \" state\");\n        }\n    }\n\n    @Override\n    public void suspend() {\n        suspend(null);\n    }\n\n    @Override\n    public synchronized void suspend(Handler<Void> completionHandler) {\n        if (processStatus == ExecStatus.RUNNING) {\n            updateStatus(ExecStatus.STOPPED, null, false, suspendHandler, terminatedHandler, completionHandler);\n            if (process != null) {\n                process.suspend();\n            }\n        } else {\n            throw new IllegalStateException(\"Cannot suspend process in \" + processStatus + \" state\");\n        }","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/alibaba/arthas/blob/21cf2e9ba52b305290be7223b980ff504bb9cb5b/core/src/main/java/com/taobao/arthas/core/shell/system/impl/ProcessImpl.java#L165-L201","documentation":"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.","triggerScenarios":"Calling 'fg' or 'bg' (which internally resume) on a job that is running normally or already terminated. Resuming a job that was never suspended.","commonSituations":"User issues 'fg <jobId>' on a job that is already in the foreground/running. Scripted job control that doesn't track suspend state.","solutions":["Only resume a job whose status is STOPPED — check with 'jobs' first.","If the job is TERMINATED, it cannot be resumed; restart the command instead."],"exampleFix":"// before\njob.process().resume();\n\n// after\nif (job.process().status() == ExecStatus.STOPPED) {\n    job.process().resume();\n}","handlingStrategy":"type-guard","validationCode":"if (process.status() == ExecStatus.STOPPED) {\n    process.resume();\n}","typeGuard":"boolean canResume(Process p) {\n    return p.status() == ExecStatus.STOPPED;\n}","tryCatchPattern":"try {\n    process.resume();\n} catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"Cannot resume\")) {\n        // not suspended; no-op\n    }\n}","preventionTips":["Only resume a process you previously suspended.","Track suspend state in job management code."],"tags":["process-state","resume","lifecycle"],"backgroundTag":null,"analyzedSha":"21cf2e9ba52b305290be7223b980ff504bb9cb5b","analyzedAt":"2026-08-14T00:57:07.243Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}