{"record":{"id":"8c764115843f5491","repo":"spring-projects/spring-boot","slug":"1-s-is-not-a-valid-command-see-help","errorCode":null,"errorMessage":"'%1$s' is not a valid command. See 'help'.","messagePattern":"'%1\\$s' is not a valid command\\. See 'help'\\.","errorType":"exception","errorClass":"NoSuchCommandException","httpStatus":null,"severity":"error","filePath":"cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java","lineNumber":217,"sourceCode":"\t\t}\n\t\treturn StringUtils.toStringArray(rtn);\n\t}\n\n\t/**\n\t * Parse the arguments and run a suitable command.\n\t * @param args the arguments\n\t * @return the outcome of the command\n\t * @throws Exception if the command fails\n\t */\n\tprotected ExitStatus run(String... args) throws Exception {\n\t\tif (args.length == 0) {\n\t\t\tthrow new NoArgumentsException();\n\t\t}\n\t\tString commandName = args[0];\n\t\tString[] commandArguments = Arrays.copyOfRange(args, 1, args.length);\n\t\tCommand command = findCommand(commandName);\n\t\tif (command == null) {\n\t\t\tthrow new NoSuchCommandException(commandName);\n\t\t}\n\t\tbeforeRun(command);\n\t\ttry {\n\t\t\treturn command.run(commandArguments);\n\t\t}\n\t\tfinally {\n\t\t\tafterRun(command);\n\t\t}\n\t}\n\n\t/**\n\t * Subclass hook called before a command is run.\n\t * @param command the command about to run\n\t */\n\tprotected void beforeRun(Command command) {\n\t}\n\n\t/**","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/spring-projects/spring-boot/blob/270dfe353fb830fd69b823a8a859287ff103854b/cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java#L199-L235","documentation":"Thrown by CommandRunner.run() when args[0] does not match any registered command. The runner calls findCommand(commandName); a null result means no command is registered under that name, so it throws NoSuchCommandException with the offending name. It is a CommandException surfaced to the CLI user.","triggerScenarios":"Invoking the spring CLI with an unknown first token, e.g. 'spring buld' (typo of 'build') or any name absent from the registered command set. The check fires before any command logic runs.","commonSituations":"Typo in a command name; expecting a command provided by an extension that is not installed/enabled; running a CLI version where the command was renamed or removed.","solutions":["Run 'spring help' to list every available command name","Correct the spelling of the command you typed","If the command comes from an extension, install or enable that extension first","Check the CLI version matches the command name you expect"],"exampleFix":"// before\n$ spring buld\n// after\n$ spring build","handlingStrategy":"validation","validationCode":"// Before invoking a command programmatically, confirm it is registered.\n// For CLI use, run `spring help` and match the name exactly.\nString name = args[0];\njava.util.List<String> known = java.util.Arrays.asList(/* from `spring help` output */);\nif (!known.contains(name)) {\n    System.err.println(\"Unknown command '\" + name + \"'. See: spring help\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"// If invoking CommandRunner programmatically:\ntry {\n    runner.run(args);\n} catch (org.springframework.boot.cli.command.NoSuchCommandException ex) {\n    System.err.println(ex.getMessage()); // already user-friendly\n}","preventionTips":["Always quote and spell-check the command name","Run 'spring help' first when unsure of available commands","Pin the CLI version in CI so command names do not change unexpectedly"],"tags":["cli","command-not-found","user-input","spring-boot-cli"],"backgroundTag":null,"analyzedSha":"270dfe353fb830fd69b823a8a859287ff103854b","analyzedAt":"2026-08-11T19:42:06.541Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}