{"id":"49ac0219a4ce3639","repo":"junit-team/junit5","slug":"missing-required-subcommand","errorCode":null,"errorMessage":"Missing required subcommand","messagePattern":"Missing required subcommand","errorType":"exception","errorClass":"ParameterException","httpStatus":null,"severity":"error","filePath":"junit-platform-console/src/main/java/org/junit/platform/console/command/MainCommand.java","lineNumber":80,"sourceCode":"\t@Nullable\n\tCommandResult<?> commandResult;\n\n\tMainCommand(ConsoleTestExecutor.Factory consoleTestExecutorFactory) {\n\t\tthis.consoleTestExecutorFactory = consoleTestExecutorFactory;\n\t}\n\n\t@Override\n\tpublic void run() {\n\t\tif (helpRequested) {\n\t\t\tcommandSpec.commandLine().usage(commandSpec.commandLine().getOut());\n\t\t\tcommandResult = CommandResult.success();\n\t\t}\n\t\telse if (versionRequested) {\n\t\t\tcommandSpec.commandLine().printVersionHelp(commandSpec.commandLine().getOut());\n\t\t\tcommandResult = CommandResult.success();\n\t\t}\n\t\telse {\n\t\t\tthrow new ParameterException(commandSpec.commandLine(), \"Missing required subcommand\");\n\t\t}\n\t}\n\n\t@Override\n\tpublic int getExitCode() {\n\t\treturn requireNonNull(commandResult).getExitCode();\n\t}\n\n\tCommandResult<?> run(String[] args,\n\t\t\t@SuppressWarnings(\"OptionalUsedAsFieldOrParameterType\") Optional<OutputStreamConfig> outputStreamConfig) {\n\t\tCommandLine commandLine = new CommandLine(this) //\n\t\t\t\t.addSubcommand(new DiscoverTestsCommand(consoleTestExecutorFactory)) //\n\t\t\t\t.addSubcommand(new ExecuteTestsCommand(consoleTestExecutorFactory)) //\n\t\t\t\t.addSubcommand(new ListTestEnginesCommand());\n\t\treturn runCommand(commandLine, args, outputStreamConfig);\n\t}\n\n\tprivate static CommandResult<?> runCommand(CommandLine commandLine, String[] args,","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/junit-team/junit5/blob/956246301e03d757539f7b76dd5a91f298637563/junit-platform-console/src/main/java/org/junit/platform/console/command/MainCommand.java#L62-L98","documentation":"Error \"Missing required subcommand\" thrown in junit-team/junit5.","triggerScenarios":"Thrown at junit-platform-console/src/main/java/org/junit/platform/console/command/MainCommand.java:80 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"956246301e03d757539f7b76dd5a91f298637563","analyzedAt":"2026-08-04T19:25:17.049Z","schemaVersion":2}