alibaba/arthas · error · IllegalArgumentException
vmtool interruptThread 需要指定线程 ID (threadId)
Error message
vmtool interruptThread 需要指定线程 ID (threadId)
What it means
For the interruptThread action, a valid positive threadId is required to identify which thread to interrupt. A null or non-positive threadId (<=0) is rejected because thread IDs are always positive in the JVM.
Source
Thrown at core/src/main/java/com/taobao/arthas/core/mcp/tool/function/jvm300/VMToolTool.java:82
}
if (ACTION_GET_INSTANCES.equals(normalizedAction)) {
if (limit != null) {
cmd.append(" --limit ").append(limit);
}
if (expandLevel != null && expandLevel > 0) {
cmd.append(" -x ").append(expandLevel);
}
if (express != null && !express.trim().isEmpty()) {
addParameter(cmd, "--express", express);
}
}
if (ACTION_INTERRUPT_THREAD.equals(normalizedAction)) {
if (threadId != null && threadId > 0) {
cmd.append(" -t ").append(threadId);
} else {
throw new IllegalArgumentException("vmtool interruptThread 需要指定线程 ID (threadId)");
}
}
return executeSync(toolContext, cmd.toString());
}
}
View on GitHub (pinned to 21cf2e9ba5)
Solutions
- Use the thread command or tool first to find the target thread's numeric ID.
- Pass a strictly positive threadId value.
- Ensure the thread still exists (it may have already terminated).
Example fix
// before vmtool(action="interruptThread") // after // first run: thread (to list threads and find nid/tid) vmtool(action="interruptThread", threadId=42)
Defensive patterns
Strategy: validation
Validate before calling
// Before calling vmtool interruptThread, validate threadId
if ("interruptThread".equals(action) && (threadId == null || threadId <= 0)) {
throw new IllegalArgumentException("A positive threadId is required for interruptThread");
} Try / catch
try {
String result = vmtool(action, ..., threadId, ...);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("threadId")) {
// threadId was missing or non-positive
}
} Prevention
- Look up the thread ID via the thread command before calling interruptThread.
- Ensure threadId is a positive long value.
- Handle the case where the thread may have already terminated.
When it happens
Trigger: Calling vmtool with action=interruptThread while omitting threadId, passing null, or passing a value <= 0.
Common situations: User forgets to look up the thread ID first; passes threadId=0; MCP client omits the field; user confuses thread name with numeric ID.
Related errors
- vmtool: action 参数不能为空
- vmtool ${normalizedAction} 需要指定类名 (className)
- actionArg is required when action=execute
- action is required
- classPattern is required for record operation
AI-assisted analysis of alibaba/arthas@21cf2e9ba5 (2026-08-14).
Data as JSON: /api/errors/b48b1679acaa58f8.
Report an issue: GitHub.