abpframework/abp · error · CliUsageException

Module name is missing!

Error message

Module name is missing!

What it means

Thrown by GetSourceCommand.ExecuteAsync when commandLineArgs.Target is null — meaning no module name was provided as the positional argument. The `abp get-source <ModuleName>` command requires a module name to download source code from ABP's source code service. The error includes usage info via GetUsageInfo().

Source

Thrown at framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs:34

    public const string Name = "get-source";
    
    private readonly SourceCodeDownloadService _sourceCodeDownloadService;
    public ModuleProjectBuilder ModuleProjectBuilder { get; }

    public ILogger<NewCommand> Logger { get; set; }

    public GetSourceCommand(ModuleProjectBuilder moduleProjectBuilder, SourceCodeDownloadService sourceCodeDownloadService)
    {
        _sourceCodeDownloadService = sourceCodeDownloadService;
        ModuleProjectBuilder = moduleProjectBuilder;
        Logger = NullLogger<NewCommand>.Instance;
    }

    public async Task ExecuteAsync(CommandLineArgs commandLineArgs)
    {
        if (commandLineArgs.Target == null)
        {
            throw new CliUsageException(
                "Module name is missing!" +
                Environment.NewLine + Environment.NewLine +
                GetUsageInfo()
            );
        }

        var version = commandLineArgs.Options.GetOrNull(Options.Version.Short, Options.Version.Long);

        var outputFolder = GetOutPutFolder(commandLineArgs);

        var gitHubAbpLocalRepositoryPath = commandLineArgs.Options.GetOrNull(Options.GitHubAbpLocalRepositoryPath.Long);
        if (gitHubAbpLocalRepositoryPath != null)
        {
            Logger.LogInformation("GitHub Abp Local Repository Path: " + gitHubAbpLocalRepositoryPath);
        }

        var gitHubVoloLocalRepositoryPath = commandLineArgs.Options.GetOrNull(Options.GitHubVoloLocalRepositoryPath.Long);
        if (gitHubVoloLocalRepositoryPath != null)

View on GitHub (pinned to 7ed43b1931)

Solutions

  1. Provide the module name as a positional argument: `abp get-source Volo.Account`
  2. Check the exact module name from ABP's module documentation or the source code download service listing
  3. Use `abp get-source --help` to see the expected usage and available module names

Example fix

// before
abp get-source

// after
abp get-source Volo.Account
Defensive patterns

Strategy: validation

Validate before calling

// Validate module name before calling GetSourceCommand
if (string.IsNullOrWhiteSpace(moduleName))
{
    Console.Error.WriteLine("Error: Module name is required. Example: abp get-source Volo.Account");
    return;
}

Try / catch

try
{
    await getSourceCommand.ExecuteAsync(commandLineArgs);
}
catch (CliUsageException ex) when (ex.Message.Contains("Module name is missing"))
{
    logger.LogError("Usage: abp get-source <ModuleName>");
}

Prevention

When it happens

Trigger: Running `abp get-source` without specifying a module name, or when the target is explicitly null. Any invocation where commandLineArgs.Target == null.

Common situations: Developer runs `abp get-source` alone expecting an interactive prompt, or a script omits the module name. Confusion about whether the module name is positional or an option.

Related errors


AI-assisted analysis of abpframework/abp@7ed43b1931 (2026-08-13). Data as JSON: /api/errors/657a315dd5d7bb01. Report an issue: GitHub.