abpframework/abp · error · CliUsageException
The option you provided for Mobile App is invalid!
Error message
The option you provided for Mobile App is invalid!
What it means
Thrown by ProjectCreationCommandBase.GetMobilePreference when the mobile app option value does not match any case. Supported values are 'none' (or null) and, only for AppPro or MicroservicePro templates, 'react-native' and 'maui'. For non-Pro templates, any mobile option other than 'none' triggers the default case throw.
Source
Thrown at framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs:652
throw new CliUsageException(ExceptionMessageHelper.GetInvalidOptionExceptionMessage("Database Management System"));
}
}
protected virtual MobileApp GetMobilePreference(CommandLineArgs commandLineArgs, string template)
{
var optionValue = commandLineArgs.Options.GetOrNull(Options.Mobile.Short, Options.Mobile.Long);
switch (optionValue)
{
case null:
case "none":
return MobileApp.None;
case "react-native" when template is AppProTemplate.TemplateName or MicroserviceProTemplate.TemplateName:
return MobileApp.ReactNative;
case "maui" when template is AppProTemplate.TemplateName or MicroserviceProTemplate.TemplateName:
return MobileApp.Maui;
default:
throw new CliUsageException(ExceptionMessageHelper.GetInvalidOptionExceptionMessage("Mobile App"));
}
}
protected virtual UiFramework GetUiFramework(CommandLineArgs commandLineArgs, string template = "app")
{
if (commandLineArgs.Options.ContainsKey("no-ui"))
{
return UiFramework.None;
}
var optionValue = commandLineArgs.Options.GetOrNull(Options.UiFramework.Short, Options.UiFramework.Long);
switch (optionValue)
{
case null:
return UiFramework.NotSpecified;
case "none":
return UiFramework.None;View on GitHub (pinned to 7ed43b1931)
Solutions
- If using a non-Pro template, omit the -m option or use `-m none`
- If you need react-native or maui mobile support, use a Pro template: `abp new MyProject -t app-pro -m react-native`
- Ensure the mobile option value is one of: none, react-native, maui
Example fix
// before — free template, mobile not supported abp new MyProject -t app -m react-native // after — use Pro template for mobile support abp new MyProject -t app-pro -m react-native // or omit mobile on free template abp new MyProject -t app -m none
Defensive patterns
Strategy: validation
Validate before calling
// Validate mobile option against the template tier
var isProTemplate = template is AppProTemplate.TemplateName or MicroserviceProTemplate.TemplateName;
var validMobile = optionValue switch
{
null or "none" => true,
"react-native" or "maui" => isProTemplate,
_ => false
};
if (!validMobile)
{
Console.Error.WriteLine("Error: Mobile option invalid or Pro-only. Use -m none or a Pro template.");
return;
} Type guard
// Type guard: mobile option valid for the given template
static bool IsValidMobileOption(string? value, string template) => value switch
{
null or "none" => true,
"react-native" => template is AppProTemplate.TemplateName or MicroserviceProTemplate.TemplateName,
"maui" => template is AppProTemplate.TemplateName or MicroserviceProTemplate.TemplateName,
_ => false
}; Try / catch
try
{
await projectCreationCommand.ExecuteAsync(commandLineArgs);
}
catch (CliUsageException ex) when (ex.Message.Contains("Mobile App is invalid"))
{
logger.LogError("react-native/maui require a Pro template. Use -m none for free templates.");
} Prevention
- react-native and maui mobile options are Pro-template-only features
- Use -m none on free/community templates
- Match the mobile option to the template tier
When it happens
Trigger: Passing `-m react-native` or `-m maui` with a non-Pro template (e.g., the free 'app' template), or passing an entirely unrecognized mobile value. The switch falls to default because the template guard (`when template is AppProTemplate.TemplateName or ...`) fails.
Common situations: Developer on the free/community ABP template tries to add mobile app support, which is a Pro-only feature. Or passing a mobile framework name not in the supported set. The template-gated case patterns mean the same value behaves differently depending on template tier.
Related errors
- The option you provided for Database Provider is invalid!
- The option you provided for Database Management System is in
- The option you provided for UI Framework is invalid!
- Project name is missing!
- You can only create a new preview solution with preview CLI
AI-assisted analysis of abpframework/abp@7ed43b1931 (2026-08-13).
Data as JSON: /api/errors/0e1c0b103f70b9d1.
Report an issue: GitHub.