abpframework/abp · error · UserFriendlyException

Invalid Arguments!

Error message

Invalid Arguments!

What it means

Thrown as UserFriendlyException by SuiteCommand.GenerateCrudPageAsync when the entity JSON file or solution file arguments fail validation. Specifically: entityFile must be non-empty, end with '.json', and exist on disk; solutionFile must be non-empty and end with '.sln' or '.slnx'. Note this is UserFriendlyException, not CliUsageException, and does not append GetUsageInfo(). Also note that File.Exists is NOT checked for the solution file.

Source

Thrown at framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs:124

            case "remove":
                Logger.LogInformation("Removing ABP Suite...");
                RemoveSuite();
                break;

            default:
                throw new CliUsageException("Invalid Suite command! Run \"abp help suite\" command to see available Suite commands.");
        }
    }

    private async Task GenerateCrudPageAsync(CommandLineArgs args)
    {
        var entityFile = args.Options.GetOrNull(Options.Crud.Entity.Short, Options.Crud.Entity.Long);
        var solutionFile = args.Options.GetOrNull(Options.Crud.Solution.Short, Options.Crud.Solution.Long);

        if (entityFile.IsNullOrEmpty() || !entityFile.EndsWith(".json") || !File.Exists(entityFile) ||
            solutionFile.IsNullOrEmpty() || !(solutionFile.EndsWith(".sln") || solutionFile.EndsWith(".slnx")))
        {
            throw new UserFriendlyException("Invalid Arguments!");
        }

        Logger.LogInformation("Generating CRUD Page...");

        var client = _cliHttpClientFactory.CreateClient(false);
        var solutionId = await GetSolutionIdAsync(client, solutionFile);

        if (!solutionId.HasValue)
        {
            return;
        }

        var IsSolutionBuiltResponse = await client.GetAsync(
            $"http://localhost:{_abpSuitePort}/api/abpSuite/solutions/{solutionId.ToString()}/is-built"
        );
        
        var IsSolutionBuilt = Convert.ToBoolean(await IsSolutionBuiltResponse.Content.ReadAsStringAsync());

View on GitHub (pinned to 7ed43b1931)

Solutions

  1. Provide --entity <absolute-path-to-entity.json> with a valid JSON file that exists on disk
  2. Provide --solution <absolute-path-to-solution.sln> or .slnx
  3. Use absolute paths to avoid relative-path resolution issues
  4. Verify both files exist before running: check with 'ls' or 'Test-Path'

Example fix

// before
abp suite generate -e MyEntity.json

// after
abp suite generate -e /home/user/MyEntity.json -s /home/user/MySolution.sln
Defensive patterns

Strategy: validation

Validate before calling

// Validate entity and solution files before calling generate
var entityFile = args.Options.GetOrNull("e", "entity");
var solutionFile = args.Options.GetOrNull("s", "solution");

if (string.IsNullOrEmpty(entityFile) || !entityFile.EndsWith(".json") || !File.Exists(entityFile))
{
    Console.Error.WriteLine("Error: --entity must be a .json file that exists on disk.");
    return;
}
if (string.IsNullOrEmpty(solutionFile) || !(solutionFile.EndsWith(".sln") || solutionFile.EndsWith(".slnx")))
{
    Console.Error.WriteLine("Error: --solution must be a .sln or .slnx file.");
    return;
}

Type guard

// Validate entity file path
public static bool IsValidEntityFile(string path)
{
    return !string.IsNullOrEmpty(path) 
           && path.EndsWith(".json") 
           && File.Exists(path);
}

// Validate solution file path
public static bool IsValidSolutionFile(string path)
{
    return !string.IsNullOrEmpty(path) 
           && (path.EndsWith(".sln") || path.EndsWith(".slnx"));
}

Try / catch

try
{
    await GenerateCrudPageAsync(args);
}
catch (UserFriendlyException ex) when (ex.Message.Contains("Invalid Arguments"))
{
    Console.Error.WriteLine("Invalid arguments. Provide --entity <file.json> and --solution <file.sln>.");
}

Prevention

When it happens

Trigger: Running 'abp suite generate' (or bare 'abp suite' with generate flow) without proper -e/--entity and -s/--solution options. Triggers when: entityFile is null/empty, entityFile doesn't end in .json, entityFile doesn't exist on disk, solutionFile is null/empty, or solutionFile doesn't end in .sln/.slnx.

Common situations: Forgetting the entity JSON file path, providing a wrong file extension for the entity file, using a relative path that doesn't resolve from the current working directory, providing a .csproj instead of .sln for the solution.

Related errors


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