{"record":{"id":"742356ff72cfaae7","repo":"quarkusio/quarkus","slug":"intentional-failure","errorCode":null,"errorMessage":"intentional failure","messagePattern":"intentional failure","errorType":"console","errorClass":"CommandException","httpStatus":null,"severity":"info","filePath":"integration-tests/aesh/src/main/java/io/quarkus/it/aesh/FailCommand.java","lineNumber":22,"sourceCode":"import org.aesh.command.CommandDefinition;\nimport org.aesh.command.CommandException;\nimport org.aesh.command.CommandResult;\nimport org.aesh.command.invocation.CommandInvocation;\nimport org.aesh.command.option.Option;\n\n/**\n * A command that always fails with an exception.\n * Used to test error capture in the AeshLauncher test framework.\n */\n@CommandDefinition(name = \"fail\", description = \"Always fails with an error\")\npublic class FailCommand implements Command<CommandInvocation> {\n\n    @Option(name = \"message\", shortName = 'm', defaultValue = \"intentional failure\")\n    String message;\n\n    @Override\n    public CommandResult execute(CommandInvocation invocation) throws CommandException {\n        throw new CommandException(message);\n    }\n}\n","sourceCodeStart":4,"sourceCodeEnd":25,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/integration-tests/aesh/src/main/java/io/quarkus/it/aesh/FailCommand.java#L4-L25","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Do not run the `fail` command if you do not want an error — it fails by design","Pass -m to supply a custom message if testing specific failure text","If you saw this unexpectedly in a test run, verify it comes from the intentional FailCommand test assertion, not a real regression"],"exampleFix":"// before\nthrow new CommandException(message);\n// after\n// no change needed: this is an intentional test command; remove/skip it if unwanted\n// quarkus:fail  ->  do not invoke; or change default via -m \"custom message\"","handlingStrategy":"validation","validationCode":"// before invoking, check the command name\nif (\"fail\".equals(commandName)) { /* expected failure — do not invoke unless testing */ }","typeGuard":null,"tryCatchPattern":"try {\n    invocation.execute(\"fail\");\n} catch (CommandException e) {\n    // expected: intentional test failure\n}","preventionTips":["Remember `fail` in this test app always throws by design","Use -m to customize the failure message when testing error output","Exclude the fail command from production command catalogs"],"tags":["cli","test","intentional-failure","command"],"backgroundTag":"intentional-test-exception","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"}