{"record":{"id":"0e1c0b103f70b9d1","repo":"abpframework/abp","slug":"the-option-you-provided-for-mobile-app-is-invalid","errorCode":null,"errorMessage":"The option you provided for Mobile App is invalid!","messagePattern":"The option you provided for Mobile App is invalid!","errorType":"exception","errorClass":"CliUsageException","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs","lineNumber":652,"sourceCode":"                throw new CliUsageException(ExceptionMessageHelper.GetInvalidOptionExceptionMessage(\"Database Management System\"));\n        }\n    }\n\n    protected virtual MobileApp GetMobilePreference(CommandLineArgs commandLineArgs, string template)\n    {\n        var optionValue = commandLineArgs.Options.GetOrNull(Options.Mobile.Short, Options.Mobile.Long);\n\n        switch (optionValue)\n        {\n            case null:\n            case \"none\":\n                return MobileApp.None;\n            case \"react-native\" when template is AppProTemplate.TemplateName or MicroserviceProTemplate.TemplateName:\n                return MobileApp.ReactNative;\n            case \"maui\" when template is AppProTemplate.TemplateName or MicroserviceProTemplate.TemplateName:\n                return MobileApp.Maui;\n            default:\n                throw new CliUsageException(ExceptionMessageHelper.GetInvalidOptionExceptionMessage(\"Mobile App\"));\n        }\n    }\n\n    protected virtual UiFramework GetUiFramework(CommandLineArgs commandLineArgs, string template = \"app\")\n    {\n        if (commandLineArgs.Options.ContainsKey(\"no-ui\"))\n        {\n            return UiFramework.None;\n        }\n\n        var optionValue = commandLineArgs.Options.GetOrNull(Options.UiFramework.Short, Options.UiFramework.Long);\n\n        switch (optionValue)\n        {\n            case null:\n                return UiFramework.NotSpecified;\n            case \"none\":\n                return UiFramework.None;","sourceCodeStart":634,"sourceCodeEnd":670,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs#L634-L670","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before — free template, mobile not supported\nabp new MyProject -t app -m react-native\n\n// after — use Pro template for mobile support\nabp new MyProject -t app-pro -m react-native\n// or omit mobile on free template\nabp new MyProject -t app -m none","handlingStrategy":"validation","validationCode":"// Validate mobile option against the template tier\nvar isProTemplate = template is AppProTemplate.TemplateName or MicroserviceProTemplate.TemplateName;\nvar validMobile = optionValue switch\n{\n    null or \"none\" => true,\n    \"react-native\" or \"maui\" => isProTemplate,\n    _ => false\n};\nif (!validMobile)\n{\n    Console.Error.WriteLine(\"Error: Mobile option invalid or Pro-only. Use -m none or a Pro template.\");\n    return;\n}","typeGuard":"// Type guard: mobile option valid for the given template\nstatic bool IsValidMobileOption(string? value, string template) => value switch\n{\n    null or \"none\" => true,\n    \"react-native\" => template is AppProTemplate.TemplateName or MicroserviceProTemplate.TemplateName,\n    \"maui\" => template is AppProTemplate.TemplateName or MicroserviceProTemplate.TemplateName,\n    _ => false\n};","tryCatchPattern":"try\n{\n    await projectCreationCommand.ExecuteAsync(commandLineArgs);\n}\ncatch (CliUsageException ex) when (ex.Message.Contains(\"Mobile App is invalid\"))\n{\n    logger.LogError(\"react-native/maui require a Pro template. Use -m none for free templates.\");\n}","preventionTips":["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"],"tags":["cli","abp-cli","invalid-option","project-creation","mobile","pro-only"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}