{"record":{"id":"6817f1f3f4f1a05a","repo":"abpframework/abp","slug":"option-type-is-required","errorCode":null,"errorMessage":"Option Type is required","messagePattern":"Option Type is required","errorType":"exception","errorClass":"CliUsageException","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProxyCommandBase.cs","lineNumber":40,"sourceCode":"\n    protected IServiceScopeFactory ServiceScopeFactory { get; }\n\n    public ProxyCommandBase(\n        IOptions<AbpCliServiceProxyOptions> serviceProxyOptions,\n        IServiceScopeFactory serviceScopeFactory)\n    {\n        ServiceScopeFactory = serviceScopeFactory;\n        ServiceProxyOptions = serviceProxyOptions.Value;\n        Logger = NullLogger<T>.Instance;\n    }\n\n    public async Task ExecuteAsync(CommandLineArgs commandLineArgs)\n    {\n        var generateType = commandLineArgs.Options.GetOrNull(Options.GenerateType.Short, Options.GenerateType.Long)?.ToUpperInvariant();\n\n        if (string.IsNullOrWhiteSpace(generateType))\n        {\n            throw new CliUsageException(\"Option Type is required\" +\n                Environment.NewLine +\n                GetUsageInfo());\n        }\n\n        if (!ServiceProxyOptions.Generators.ContainsKey(generateType))\n        {\n            throw new CliUsageException(\"Option Type value is invalid\" +\n                Environment.NewLine +\n                GetUsageInfo());\n        }\n\n        using (var scope = ServiceScopeFactory.CreateScope())\n        {\n            var generatorType = ServiceProxyOptions.Generators[generateType];\n            var serviceProxyGenerator = scope.ServiceProvider.GetService(generatorType).As<IServiceProxyGenerator>();\n\n            await serviceProxyGenerator.GenerateProxyAsync(BuildArgs(commandLineArgs));\n        }","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProxyCommandBase.cs#L22-L58","documentation":"Thrown by ProxyCommandBase.ExecuteAsync when the -t/--type option is entirely absent from the command line. The proxy generation system (used by 'abp generate-proxy', 'abp generate-proxy -t csharp', etc.) requires a generator type to know which proxy format to produce. Valid types are 'csharp', 'js', and 'ng' (the value is uppercased before dictionary lookup).","triggerScenarios":"Running any proxy command inheriting from ProxyCommandBase without the -t/--type flag. For example: 'abp generate-proxy -m app' without specifying '--type'. The CommandLineArgs.Options.GetOrNull returns null, IsNullOrWhiteSpace is true, and the exception fires.","commonSituations":"Developer forgets the required --type option, follows outdated documentation that didn't require it, or confuses the generate-proxy command syntax with another CLI command.","solutions":["Add -t csharp (or -t js / -t ng) to your generate-proxy command","Run 'abp help generate-proxy' to see all available options and valid type values","For C# proxies: 'abp generate-proxy -t csharp -m app -u https://localhost:44300'","For Angular proxies: 'abp generate-proxy -t ng -m app'"],"exampleFix":"// before\nabp generate-proxy -m app\n\n// after\nabp generate-proxy -t csharp -m app","handlingStrategy":"validation","validationCode":"// Validate before invoking proxy command\nvar typeOption = commandLineArgs.Options.GetOrNull(\"t\", \"type\");\nif (string.IsNullOrWhiteSpace(typeOption))\n{\n    Console.Error.WriteLine(\"Error: -t/--type is required. Use csharp, js, or ng.\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    await proxyCommand.ExecuteAsync(commandLineArgs);\n}\ncatch (CliUsageException ex) when (ex.Message.Contains(\"Option Type is required\"))\n{\n    Console.Error.WriteLine($\"Missing required --type option.\\nUsage: abp generate-proxy -t <csharp|js|ng>\");\n}","preventionTips":["Always include -t/--type when running proxy generation commands","Create shell aliases or scripts that include the type flag by default","Review 'abp help generate-proxy' output before first use"],"tags":["cli","proxy-generation","missing-argument","command-line"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}