{"record":{"id":"86ffb13e8a1f5472","repo":"stride3d/stride","slug":"you-need-to-specify-a-command","errorCode":null,"errorMessage":"You need to specify a command","messagePattern":"You need to specify a command","errorType":"validation","errorClass":"OptionException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Tasks/Program.cs","lineNumber":77,"sourceCode":"                string.Empty,\n                \"=== Options ===\",\n                string.Empty,\n                { \"pack-asset-assembly=\", \"Host-loadable asset assembly (package-relative path) to declare in the packed sdpkg; repeat for each\", v => packAssetAssemblies.Add(v) },\n                { \"h|help\", \"Show this message and exit\", v => showHelp = v != null },\n            };\n\n            try\n            {\n                var commandArgs = p.Parse(args);\n                if (showHelp)\n                {\n                    p.WriteOptionDescriptions(Console.Out);\n                    return 0;\n                }\n\n                // Make sure path exists\n                if (commandArgs.Count == 0)\n                    throw new OptionException(\"You need to specify a command\", \"\");\n\n                switch (commandArgs[0])\n                {\n                    case \"locate-devenv\":\n                    {\n                        if(!OperatingSystem.IsWindows())\n                            throw new OptionException(\"This option is only available on Windows\", \"\");\n                            \n                        if (commandArgs.Count != 2)\n                            throw new OptionException(\"Need one extra argument\", \"\");\n                        var devenvPath = LocateDevenv.FindDevenv(commandArgs[1]);\n                        if (devenvPath == null)\n                        {\n                            Console.WriteLine(\"Could not locate devenv\");\n                            return 1;\n                        }\n                        Console.WriteLine(devenvPath);\n                        break;","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Tasks/Program.cs#L59-L95","documentation":"The Stride.Core.Tasks command-line tool requires a command as its first positional argument (e.g. locate-devenv, pack-assets). When commandArgs is empty, RealMain throws OptionException telling you a command must be supplied.","triggerScenarios":"Running the tool executable with no positional arguments, or only with options such that commandArgs.Count == 0.","commonSituations":"Invoking the tool bare to 'see what happens'; a build script that drops its arguments due to quoting issues; calling it expecting a GUI or default command.","solutions":["Pass a valid command as the first argument, e.g. Stride.Core.Tasks pack-assets <csproj> <intermediatePath>.","Run the tool with --help to list available commands and their expected arguments.","Fix the build script quoting so arguments are forwarded correctly."],"exampleFix":"// before\nStride.Core.Tasks\n// after\nStride.Core.Tasks locate-devenv \"C:\\Program Files\\Microsoft Visual Studio\"","handlingStrategy":"validation","validationCode":"// before invoking, check args\nif (args.Length == 0)\n{\n    Console.WriteLine(\"Usage: Stride.Core.Tasks <command> [args]\");\n    return 1;\n}","typeGuard":null,"tryCatchPattern":"try { return RealMain(args); }\ncatch (OptionException ex) { Console.Error.WriteLine(ex.Message); return 1; }","preventionTips":["Always pass a command as the first argument","Use --help to discover commands","Quote arguments in build scripts"],"tags":["cli","missing-argument"],"backgroundTag":"missing-cli-argument","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}