abpframework/abp · error · CliUsageException
Option Type is required
Error message
Option Type is required
What it means
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).
Source
Thrown at framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProxyCommandBase.cs:40
protected IServiceScopeFactory ServiceScopeFactory { get; }
public ProxyCommandBase(
IOptions<AbpCliServiceProxyOptions> serviceProxyOptions,
IServiceScopeFactory serviceScopeFactory)
{
ServiceScopeFactory = serviceScopeFactory;
ServiceProxyOptions = serviceProxyOptions.Value;
Logger = NullLogger<T>.Instance;
}
public async Task ExecuteAsync(CommandLineArgs commandLineArgs)
{
var generateType = commandLineArgs.Options.GetOrNull(Options.GenerateType.Short, Options.GenerateType.Long)?.ToUpperInvariant();
if (string.IsNullOrWhiteSpace(generateType))
{
throw new CliUsageException("Option Type is required" +
Environment.NewLine +
GetUsageInfo());
}
if (!ServiceProxyOptions.Generators.ContainsKey(generateType))
{
throw new CliUsageException("Option Type value is invalid" +
Environment.NewLine +
GetUsageInfo());
}
using (var scope = ServiceScopeFactory.CreateScope())
{
var generatorType = ServiceProxyOptions.Generators[generateType];
var serviceProxyGenerator = scope.ServiceProvider.GetService(generatorType).As<IServiceProxyGenerator>();
await serviceProxyGenerator.GenerateProxyAsync(BuildArgs(commandLineArgs));
}View on GitHub (pinned to 7ed43b1931)
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'
Example fix
// before abp generate-proxy -m app // after abp generate-proxy -t csharp -m app
Defensive patterns
Strategy: validation
Validate before calling
// Validate before invoking proxy command
var typeOption = commandLineArgs.Options.GetOrNull("t", "type");
if (string.IsNullOrWhiteSpace(typeOption))
{
Console.Error.WriteLine("Error: -t/--type is required. Use csharp, js, or ng.");
return;
} Try / catch
try
{
await proxyCommand.ExecuteAsync(commandLineArgs);
}
catch (CliUsageException ex) when (ex.Message.Contains("Option Type is required"))
{
Console.Error.WriteLine($"Missing required --type option.\nUsage: abp generate-proxy -t <csharp|js|ng>");
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Option Type value is invalid
- Local paths are not specified!
- Target culture is missing!
- DbMigrations folder path is missing!
- Module name is missing!
AI-assisted analysis of abpframework/abp@7ed43b1931 (2026-08-13).
Data as JSON: /api/errors/6817f1f3f4f1a05a.
Report an issue: GitHub.