quarkusio/quarkus · error · IllegalArgumentException
the command line cannot be null.
Error message
the command line cannot be null.
What it means
MavenProcessInvoker's private executeCommandLine(Commandline cl, ...) throws IllegalArgumentException("the command line cannot be null.") when the resolved Commandline is null. This is an internal defensive check: it fires only if a null cli reached the process-spawning overload, meaning the CLI was never built successfully yet execution proceeded. Callers normally see the sibling MavenInvocationException (error 4081) instead.
Source
Thrown at test-framework/maven/src/main/java/io/quarkus/maven/it/verifier/MavenProcessInvoker.java:88
result.setProcess(process);
} catch (CommandLineException e) {
result.setException(e);
}
return result;
}
private Process executeCommandLine(Commandline cli, InvocationRequest request)
throws CommandLineException {
InvocationOutputHandler outputHandler = request.getOutputHandler(this.outputHandler);
InvocationOutputHandler errorHandler = request.getErrorHandler(this.errorHandler);
return executeCommandLine(cli, outputHandler, errorHandler);
}
private static Process executeCommandLine(Commandline cl, StreamConsumer systemOut, StreamConsumer systemErr)
throws CommandLineException {
if (cl == null) {
throw new IllegalArgumentException("the command line cannot be null.");
} else {
final Process p = cl.execute();
final StreamPumper outputPumper = new StreamPumper(p.getInputStream(), systemOut);
final StreamPumper errorPumper = new StreamPumper(p.getErrorStream(), systemErr);
outputPumper.start();
errorPumper.start();
new Thread(() -> {
try {
// Wait for termination
p.waitFor();
outputPumper.waitUntilDone();
errorPumper.waitUntilDone();
} catch (Exception e) {
outputPumper.disable();
errorPumper.disable();
e.printStackTrace();View on GitHub (pinned to e1c734241f)
Solutions
- Ensure MavenProcessInvoker.execute() is used to launch Maven so cli is always built (or MavenInvocationException thrown) before executeCommandLine runs.
- Null-check the Commandline before invoking executeCommandLine and fail fast with a clear message.
- If building the CLI yourself, verify cliBuilder.build(request) returned non-null and handle CommandLineConfigurationException.
Example fix
// before Process p = invoker.executeCommandLine(null, out, err); // after Commandline cli = cliBuilder.build(request); Objects.requireNonNull(cli, "Maven CLI command line was not built"); Process p = invoker.executeCommandLine(cli, out, err);
Defensive patterns
Strategy: validation
Validate before calling
if (cli == null) {
throw new IllegalArgumentException("CLI must be built via cliBuilder.build(request) before executeCommandLine");
} Type guard
boolean hasCli(Commandline cl) {
return cl != null;
} Try / catch
try {
Process p = executeCommandLine(cl, out, err);
} catch (IllegalArgumentException e) {
throw new IllegalStateException("No command line configured for Maven invocation", e);
} Prevention
- Always launch Maven through MavenProcessInvoker.execute(), never call executeCommandLine with a manually obtained cli.
- Handle CommandLineConfigurationException at build time so a null cli can never reach process spawning.
- Add Objects.requireNonNull(cli) assertions in custom invoker subclasses.
- Keep invoker request construction and execution in the same method to avoid passing unbuilt state.
When it happens
Trigger: A code path in MavenProcessInvoker where cli resolution (executeCommandLine(cli, outputHandler, errorHandler) delegating to the 3-arg overload) receives null — i.e. invoking executeCommandLine directly with a null Commandline after a failed/unperformed cliBuilder.build().
Common situations: Custom subclasses or forks of MavenProcessInvoker that call executeCommandLine with an unbuilt cli; refactoring mistakes where build failure handling is bypassed; reflection-based test harnesses passing null.
Related errors
- Contextual parameter must not be null
- `member` cannot be `null`
- `unit` cannot be `null`
- `" + name + "` must not be `null`
- The TLS configuration to register cannot be null
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/e52047c68699006b.
Report an issue: GitHub.