alibaba/arthas · error · IllegalStateException

Current OS do not support AsyncProfiler, Only support…

Error message

Current OS do not support AsyncProfiler, Only support Linux/Mac.

What it means

Thrown by profilerInstance() in the `profiler` command when the operating system is neither Linux nor macOS and no explicit libPath/load action is provided. async-profiler only ships native libraries for Linux and Mac, so Windows (and other OSes) are explicitly unsupported.

Solutions

  1. Run arthas and the profiler on Linux or macOS instead.
  2. On Windows, use WSL2 with a Linux JDK to access the Linux native lib.
  3. If you have a custom-built native lib, load it explicitly via `profiler load /path/to/lib`.

Example fix

// before (on Windows)
profiler start
// after (run inside WSL2/Linux)
profiler start
Defensive patterns

Strategy: type-guard

Validate before calling

String os = System.getProperty("os.name").toLowerCase();
boolean supported = os.contains("linux") || os.contains("mac");
if (!supported && libPath == null) {
    System.err.println("AsyncProfiler needs Linux/Mac; use WSL on Windows");
}

Type guard

static boolean profilerOsSupported() {
    String os = System.getProperty("os.name", "").toLowerCase();
    return os.contains("linux") || os.contains("mac");
}

Try / catch

null

Prevention

When it happens

Trigger: Running `profiler start` on Windows or any non-Linux/non-Mac OS without providing a libPath via `profiler load`.

Common situations: Trying to use the profiler from a Windows development machine; running arthas inside WSL but the JVM reports the host OS oddly; using an exotic OS.

Related errors


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

Appendix: source

Thrown at core/src/main/java/com/taobao/arthas/core/command/monitor200/ProfilerCommand.java:585

                File tmpLibFile = File.createTempFile(VmTool.JNI_LIBRARY_NAME, null);
                tmpLibOutputStream = new FileOutputStream(tmpLibFile);
                libInputStream = new FileInputStream(libPath);

                IOUtils.copy(libInputStream, tmpLibOutputStream);
                libPath = tmpLibFile.getAbsolutePath();
                logger.debug("copy {} to {}", libPath, tmpLibFile);
            } catch (Throwable e) {
                logger.error("try to copy lib error! libPath: {}", libPath, e);
            } finally {
                IOUtils.close(libInputStream);
                IOUtils.close(tmpLibOutputStream);
            }
            profiler = AsyncProfiler.getInstance(libPath);
        } else {
            if (OSUtils.isLinux() || OSUtils.isMac()) {
                throw new IllegalStateException("Can not find libasyncProfiler so, please check the arthas directory.");
            } else {
                throw new IllegalStateException("Current OS do not support AsyncProfiler, Only support Linux/Mac.");
            }
        }

        return profiler;
    }

    /**
     * https://github.com/async-profiler/async-profiler/blob/v4.4/src/arguments.cpp
     */
    public enum ProfilerAction {
        // start, resume, stop, dump, status, meminfo, list,
        start, resume, stop, dump, status, meminfo, list,
        version,

        load,
        execute,
        dumpCollapsed, dumpFlat, dumpTraces, getSamples,
        actions

View on GitHub (pinned to 21cf2e9ba5)