{"record":{"id":"8f082bb53f68a2d4","repo":"abpframework/abp","slug":"option-type-value-is-invalid","errorCode":null,"errorMessage":"Option Type value is invalid","messagePattern":"Option Type value is invalid","errorType":"exception","errorClass":"CliUsageException","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProxyCommandBase.cs","lineNumber":47,"sourceCode":"        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        }\n    }\n\n    private GenerateProxyArgs BuildArgs(CommandLineArgs commandLineArgs)\n    {\n        var url = commandLineArgs.Options.GetOrNull(Options.Url.Short, Options.Url.Long);\n        var target = commandLineArgs.Options.GetOrNull(Options.Target.Long);\n        var module = commandLineArgs.Options.GetOrNull(Options.Module.Short, Options.Module.Long) ?? \"app\";","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProxyCommandBase.cs#L29-L65","documentation":"Thrown by ProxyCommandBase.ExecuteAsync when the -t/--type value IS provided but does not match any key in ServiceProxyOptions.Generators. The value is uppercased (ToUpperInvariant) before lookup, so 'CSharp', 'CSHARP', 'csharp' all resolve to 'CSHARP'. The Generators dictionary is populated from AbpCliServiceProxyOptions configuration, which by default includes CSHARP, JS, and NG generators.","triggerScenarios":"Passing an unrecognized type string like 'abp generate-proxy -t typescript' or '-t java' or '-t python'. The ContainsKey check on the Generators dictionary returns false.","commonSituations":"Typo in the type name (e.g., 'c-sharp' instead of 'csharp'), guessing at supported types, or a custom proxy generator that hasn't been registered in AbpCliServiceProxyOptions.","solutions":["Use one of the valid type values: csharp, js, or ng","Run 'abp help generate-proxy' to confirm valid type values for your ABP version","If using a custom generator, register it in AbpCliServiceProxyOptions.Generators before calling ExecuteAsync"],"exampleFix":"// before\nabp generate-proxy -t typescript -m app\n\n// after\nabp generate-proxy -t csharp -m app","handlingStrategy":"validation","validationCode":"// Validate type value against known generators before invoking\nvar validTypes = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { \"csharp\", \"js\", \"ng\" };\nvar typeOption = commandLineArgs.Options.GetOrNull(\"t\", \"type\");\nif (typeOption != null && !validTypes.Contains(typeOption))\n{\n    Console.Error.WriteLine($\"Error: '{typeOption}' is not a valid type. Use: {string.Join(\", \", validTypes)}\");\n    return;\n}","typeGuard":"// Type guard for valid proxy generation types\npublic static bool IsValidProxyType(string type)\n{\n    return type != null && \n           new[] { \"csharp\", \"js\", \"ng\" }.Contains(type, StringComparer.OrdinalIgnoreCase);\n}","tryCatchPattern":"try\n{\n    await proxyCommand.ExecuteAsync(commandLineArgs);\n}\ncatch (CliUsageException ex) when (ex.Message.Contains(\"Option Type value is invalid\"))\n{\n    Console.Error.WriteLine($\"Invalid type. Valid values: csharp, js, ng\");\n}","preventionTips":["Memorize the three valid types: csharp, js, ng","Use tab-completion or shell scripts that constrain type choices","Check the Generators dictionary keys if extending with custom generators"],"tags":["cli","proxy-generation","invalid-argument","command-line"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}