alibaba/arthas · critical · IllegalStateException
Arthas server did not start after attach (no listener on {ip
Error message
Arthas server did not start after attach (no listener on {ip}:{telnetPort}), see errors above and the target's arthas.log What it means
Thrown by Arthas.main attach path: the attach handshake to the target JVM succeeded, but the in-target Arthas server never opened a listener on the expected ip:telnetPort (probe failed). The message is a deliberately loud, actionable failure for the cross mount-namespace attach scenario where resources copied into the target (/proc/<pid>/root/.../arthas-<pid>) may be incomplete or the server bind failed inside the target.
Source
Thrown at core/src/main/java/com/taobao/arthas/core/Arthas.java:477
try {
Thread.sleep(300);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
break;
}
}
}
// 失败:大声报错,并给出可操作的排查路径
String copiedHome = "/proc/" + targetPid + "/root" + detectTargetTmpDir(targetPid) + "/arthas-" + targetPid;
AnsiLog.error("Arthas server did NOT start on {}:{} after attach. The attach handshake succeeded, but the "
+ "in-target server failed to bind.", ip, telnetPort);
AnsiLog.error("Common cause under cross mount-namespace: incomplete resources copied into the target, or a "
+ "bind failure inside the target JVM.");
AnsiLog.error("Copied arthas home in target: {}", copiedHome);
AnsiLog.error("Check the target's arthas.log for the real cause, e.g.: find /proc/{}/root -name arthas.log",
targetPid);
throw new IllegalStateException("Arthas server did not start after attach (no listener on " + ip + ":"
+ telnetPort + "), see errors above and the target's arthas.log");
}
private static String encodeArg(String arg) {
try {
return URLEncoder.encode(arg, "utf-8");
} catch (UnsupportedEncodingException e) {
return arg;
}
}
public static void main(String[] args) {
try {
new Arthas(args);
} catch (Throwable t) {
AnsiLog.error("Start arthas failed, exception stack trace: ");
t.printStackTrace();
System.exit(-1);View on GitHub (pinned to 21cf2e9ba5)
Solutions
- Read the target's arthas.log: find /proc/<pid>/root -name arthas.log — the real cause (class not found, bind refused, missing jar) is logged there.
- Verify the copied home in the target is complete: ls -la /proc/<pid>/root<tmp>/arthas-<pid>.
- Run arthas from inside the target's namespace (exec into the container, or use -h/--target-ip pointing at the right interface).
- Ensure the target's telnetPort is free inside that namespace and reachable from where you connect.
- Clean a stale in-target arthas dir and re-attach.
Example fix
// before java -jar arthas-boot.jar <pid> // from host, target in container // after # exec into the target container and attach from inside kubectl exec -it <pod> -- sh -c 'cd /tmp && java -jar arthas-boot.jar 1'
Defensive patterns
Strategy: fallback
Try / catch
try {
arthasAttach(pid, ip, telnetPort);
} catch (IllegalStateException e) {
// read /proc/<pid>/root/.../arthas.log, clean stale home, then attach from inside the target namespace
} Prevention
- For cross-namespace targets, prefer attaching from inside the container.
- Verify the copied arthas home under /proc/<pid>/root is complete before relying on it.
- Ensure the telnetPort is free and reachable in the target namespace.
- Always check the target's arthas.log for the true root cause.
When it happens
Trigger: Cross-mount-namespace attach (e.g. arthas running in a sidecar/host attaching to a target JVM in a container) where the attach succeeds but the telnet/http server does not bind; incomplete copy of the Arthas home into the target's mount namespace; a bind failure (port conflict, permission) inside the target JVM after attach.
Common situations: Attaching arthas from outside a container to a JVM inside it; targeting a process in a different PID/mount namespace; stale arthas home in the target blocking re-copy; the requested ip/telnetPort cannot be bound in the target namespace.
Related errors
- 元数据获取失败
- 火焰图获取失败
- Failed to create directory within ${TEMP_DIR_ATTEMPTS} attem
- Could not find an available tcp port in the range [%d, %d] a
- Arthas failed to bind telnet or http port! Telnet port: ${co
AI-assisted analysis of alibaba/arthas@21cf2e9ba5 (2026-08-14).
Data as JSON: /api/errors/b61485ecb12df2c5.
Report an issue: GitHub.