{"record":{"id":"0441ee38d43b42e9","repo":"quarkusio/quarkus","slug":"no-process","errorCode":null,"errorMessage":"No process","messagePattern":"No process","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"test-framework/maven/src/main/java/io/quarkus/maven/it/verifier/MavenProcessInvocationResult.java","lineNumber":51,"sourceCode":"\n    public MavenProcessInvocationResult setException(CommandLineException exception) {\n        // Print the stack trace immediately to give some feedback early\n        // In intellij, the used `mvn` executable is not \"executable\" by default on Mac and probably linux.\n        // You need to chmod +x the file.\n        exception.printStackTrace();\n        this.exception = exception;\n        return this;\n    }\n\n    @Override\n    public CommandLineException getExecutionException() {\n        return exception;\n    }\n\n    @Override\n    public int getExitCode() {\n        if (process == null) {\n            throw new IllegalStateException(\"No process\");\n        } else {\n            return process.exitValue();\n        }\n    }\n\n    public Process getProcess() {\n        return process;\n    }\n}\n","sourceCodeStart":33,"sourceCodeEnd":61,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/test-framework/maven/src/main/java/io/quarkus/maven/it/verifier/MavenProcessInvocationResult.java#L33-L61","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","Wrap getExitCode() in a null/exception guard: catch IllegalStateException or check result.getProcess() != null first.","If the invocation never produced a process, re-run execute() and check MavenProcessInvocationResult.getException()/logs for the launch failure."],"exampleFix":"// before\nint exit = result.getExitCode();\n// after\nProcess p = result.getProcess();\nif (p == null) {\n    throw new AssertionError(\"Maven process did not start: \" + result.getException());\n}\nint exit = p.waitFor();","handlingStrategy":"type-guard","validationCode":"if (result.getProcess() == null) {\n    throw new IllegalStateException(\"Maven process not started yet: \" + result.getException());\n}","typeGuard":"boolean hasProcess(MavenProcessInvocationResult r) {\n    return r.getProcess() != null;\n}","tryCatchPattern":"try {\n    int exit = result.getExitCode();\n} catch (IllegalStateException e) {\n    // process not started; wait for getProcess() != null and retry\n}","preventionTips":["Always obtain the Process via getProcess() and wait for non-null before polling the exit code.","Use waitFor() on the Process rather than repeatedly calling getExitCode().","Check getException() on the result to detect invocation failures before querying exit codes.","In test harnesses, add a startup latch/timeout when launching continuous-testing Maven runs."],"tags":["java","maven","test-framework","race-condition"],"backgroundTag":"process-not-started","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}