{"record":{"id":"5677de86736ebae5","repo":"abpframework/abp","slug":"module-name-args-module-is-invalid","errorCode":null,"errorMessage":"Module name: {args.Module} is invalid","messagePattern":"Module name: (.+?) is invalid","errorType":"exception","errorClass":"CliUsageException","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/ServiceProxyGeneratorBase.cs","lineNumber":43,"sourceCode":"        JsonSerializer = jsonSerializer;\n        Logger = NullLogger<T>.Instance;\n    }\n\n    public abstract Task GenerateProxyAsync(GenerateProxyArgs args);\n\n    protected virtual async Task<ApplicationApiDescriptionModel> GetApplicationApiDescriptionModelAsync(GenerateProxyArgs args, ApplicationApiDescriptionModelRequestDto requestDto = null)\n    {\n        Check.NotNull(args.Url, nameof(args.Url));\n\n        var client = CliHttpClientFactory.CreateClient(needsAuthentication: false);\n\n        var apiDefinitionResult = await client.GetStringAsync(CliUrls.GetApiDefinitionUrl(args.Url, requestDto));\n        var apiDefinition = JsonSerializer.Deserialize<ApplicationApiDescriptionModel>(apiDefinitionResult);\n\n        var moduleDefinition = apiDefinition.Modules.FirstOrDefault(x => string.Equals(x.Key, args.Module, StringComparison.CurrentCultureIgnoreCase)).Value;\n        if (moduleDefinition == null)\n        {\n            throw new CliUsageException($\"Module name: {args.Module} is invalid\");\n        }\n\n        var serviceType = GetServiceType(args);\n        switch (serviceType)\n        {\n            case ServiceType.Application:\n                moduleDefinition.Controllers.RemoveAll(x => x.Value.IsIntegrationService);\n                break;\n            case ServiceType.Integration:\n                moduleDefinition.Controllers.RemoveAll(x => !x.Value.IsIntegrationService);\n                break;\n        }\n\n        var apiDescriptionModel = ApplicationApiDescriptionModel.Create();\n        apiDescriptionModel.Types = apiDefinition.Types;\n        apiDescriptionModel.AddModule(moduleDefinition);\n        return apiDescriptionModel;\n    }","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/ServiceProxyGeneratorBase.cs#L25-L61","documentation":"Thrown by the ABP CLI proxy generator when the --module argument does not match any module key in the application's API description model (the /api/abp/api-definition payload fetched from args.Url). The lookup is case-insensitive (CurrentCultureIgnoreCase), so only a spelling mismatch or a module that simply is not exposed would cause a null result. This is a CliUsageException, meaning it signals bad CLI input rather than an internal failure.","triggerScenarios":"Running `abp generate-proxy -t csharp -m <Module> --url <serverUrl>` (or the Application/Integration/JavaScript variants) where <Module> is not among the keys in apiDefinition.Modules. Also triggered if the fetched API definition is empty/malformed so no modules are present.","commonSituations":"Typo in the module name; passing the .NET project name instead of the ABP module key; targeting a server URL whose API definition was filtered or that runs an older ABP version exposing different module names; specifying --module when the target app only has a single default module under a different key.","solutions":["Open <serverUrl>/api/abp/api-definition in a browser and copy the exact module key (top-level object key under modules) to use as --module.","Drop the --module argument entirely if you want proxies for all modules, which bypasses the single-module filter.","Verify the server is running and reachable from the CLI, and that it is an ABP application exposing the api-definition endpoint.","Make sure you target an ABP server version whose module names match what you expect (module keys can change between major versions)."],"exampleFix":"// before\nabp generate-proxy -t csharp -u https://localhost:44300 -m MyApp\n\n// after (use the exact module key from /api/abp/api-definition, e.g. \"app\")\nabp generate-proxy -t csharp -u https://localhost:44300 -m app\n\n// or omit --module to generate for all modules\nabp generate-proxy -t csharp -u https://localhost:44300","handlingStrategy":"validation","validationCode":"// Fetch the API definition and confirm the module key before running generate-proxy\nusing var http = new HttpClient();\nvar json = await http.GetStringAsync($\"{serverUrl.TrimEnd('/')}/api/abp/api-definition\");\nusing var doc = JsonDocument.Parse(json);\nvar keys = doc.RootElement.GetProperty(\"modules\").EnumerateObject().Select(p => p.Name).ToList();\nif (!keys.Any(k => k.Equals(moduleName, StringComparison.OrdinalIgnoreCase)))\n    throw new InvalidOperationException($\"Module '{moduleName}' not in: {string.Join(\", \", keys)}\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always copy the --module value verbatim from the /api/abp/api-definition JSON.","Omit --module to generate proxies for all modules when unsure.","Confirm the target server is an ABP app and is reachable before generating."],"tags":["abp-cli","proxy-generation","cli-usage","api-definition"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}