quarkusio/quarkus · error · IllegalStateException

No process

Error message

No process

What it means

MavenProcessInvocationResult.getExitCode() throws IllegalStateException("No process") when called before the underlying Maven process has been started or captured. The result object is created by MavenProcessInvoker before the Process is launched and the process field is only set asynchronously, so calling getExitCode() too early (or after invocation failed to start) means there is no process to query. This is a programming/API-usage error, not a Maven failure.

Source

Thrown at test-framework/maven/src/main/java/io/quarkus/maven/it/verifier/MavenProcessInvocationResult.java:51

    public MavenProcessInvocationResult setException(CommandLineException exception) {
        // Print the stack trace immediately to give some feedback early
        // In intellij, the used `mvn` executable is not "executable" by default on Mac and probably linux.
        // You need to chmod +x the file.
        exception.printStackTrace();
        this.exception = exception;
        return this;
    }

    @Override
    public CommandLineException getExecutionException() {
        return exception;
    }

    @Override
    public int getExitCode() {
        if (process == null) {
            throw new IllegalStateException("No process");
        } else {
            return process.exitValue();
        }
    }

    public Process getProcess() {
        return process;
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Wait for the process before querying the exit code: use result.getProcess() (or the await-style API) until it returns non-null, then call process.waitFor()/exitValue.
  2. Wrap getExitCode() in a null/exception guard: catch IllegalStateException or check result.getProcess() != null first.
  3. If the invocation never produced a process, re-run execute() and check MavenProcessInvocationResult.getException()/logs for the launch failure.

Example fix

// before
int exit = result.getExitCode();
// after
Process p = result.getProcess();
if (p == null) {
    throw new AssertionError("Maven process did not start: " + result.getException());
}
int exit = p.waitFor();
Defensive patterns

Strategy: type-guard

Validate before calling

if (result.getProcess() == null) {
    throw new IllegalStateException("Maven process not started yet: " + result.getException());
}

Type guard

boolean hasProcess(MavenProcessInvocationResult r) {
    return r.getProcess() != null;
}

Try / catch

try {
    int exit = result.getExitCode();
} catch (IllegalStateException e) {
    // process not started; wait for getProcess() != null and retry
}

Prevention

When it happens

Trigger: Calling getExitCode() on the MavenProcessInvocationResult returned by MavenProcessInvoker.execute() before await/getProcess has observed the process, or when the invoker failed to spawn the process so the result never holds one.

Common situations: Test frameworks invoking Maven (e.g. Quarkus integration tests like testResourcesFromClasspath or testQuarkusTestWithThirdPartyExtension) that poll exit codes immediately after launching `mvn` without first waiting for startup; race conditions in continuous-testing helper code; invocation failing before process creation.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/0441ee38d43b42e9. Report an issue: GitHub.