quarkusio/quarkus · info · CommandException

intentional failure

Error message

intentional failure

What it means

FailCommand is a test CLI command in the aesht integration test that always throws CommandException with a configurable message (default "intentional failure"). It exists to verify that Quarkus AESH/Picocli command failures surface correctly (non-zero exit, error output) — it is a deliberate error, not a bug.

Source

Thrown at integration-tests/aesh/src/main/java/io/quarkus/it/aesh/FailCommand.java:22

import org.aesh.command.CommandDefinition;
import org.aesh.command.CommandException;
import org.aesh.command.CommandResult;
import org.aesh.command.invocation.CommandInvocation;
import org.aesh.command.option.Option;

/**
 * A command that always fails with an exception.
 * Used to test error capture in the AeshLauncher test framework.
 */
@CommandDefinition(name = "fail", description = "Always fails with an error")
public class FailCommand implements Command<CommandInvocation> {

    @Option(name = "message", shortName = 'm', defaultValue = "intentional failure")
    String message;

    @Override
    public CommandResult execute(CommandInvocation invocation) throws CommandException {
        throw new CommandException(message);
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Do not run the `fail` command if you do not want an error — it fails by design
  2. Pass -m to supply a custom message if testing specific failure text
  3. If you saw this unexpectedly in a test run, verify it comes from the intentional FailCommand test assertion, not a real regression

Example fix

// before
throw new CommandException(message);
// after
// no change needed: this is an intentional test command; remove/skip it if unwanted
// quarkus:fail  ->  do not invoke; or change default via -m "custom message"
Defensive patterns

Strategy: validation

Validate before calling

// before invoking, check the command name
if ("fail".equals(commandName)) { /* expected failure — do not invoke unless testing */ }

Try / catch

try {
    invocation.execute("fail");
} catch (CommandException e) {
    // expected: intentional test failure
}

Prevention

When it happens

Trigger: Executing the fail command (e.g. `fail` in the quarkus CLI integrated app), optionally with -m/--message to override the thrown message; execute() unconditionally throws CommandException(message).

Common situations: Running the aesh integration test suite; manually testing CLI error handling/exit codes; accidentally invoking the `fail` command while exploring the test app's commands.

Related errors


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