abpframework/abp · error · CliUsageException

Password is missing!

Error message

Password is missing!

What it means

Thrown by LoginCommand.ExecuteAsync when no password is provided via the -p/--password option and the interactive password prompt returns null or whitespace. The code first checks for the -p option; if absent, it prompts via ConsoleHelper.ReadSecret(). If the user enters an empty string at the secret prompt, it throws CliUsageException.

Source

Thrown at framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LoginCommand.cs:64

                    GetUsageInfo()
                );
            }

            var organization = commandLineArgs.Options.GetOrNull(Options.Organization.Short, Options.Organization.Long);

            if (await HasMultipleOrganizationAndThisNotSpecified(commandLineArgs, organization))
            {
                return;
            }

            var password = commandLineArgs.Options.GetOrNull(Options.Password.Short, Options.Password.Long);
            if (password == null)
            {
                Console.Write("Password: ");
                password = ConsoleHelper.ReadSecret();
                if (password.IsNullOrWhiteSpace())
                {
                    throw new CliUsageException(
                        "Password is missing!" +
                        Environment.NewLine + Environment.NewLine +
                        GetUsageInfo()
                    );
                }
            }

            try
            {
                await AuthService.LoginAsync(
                    commandLineArgs.Target,
                    password,
                    organization
                );
            }
            catch (Exception ex)
            {
                LogCliError(ex, commandLineArgs);

View on GitHub (pinned to 7ed43b1931)

Solutions

  1. Pass the password non-interactively: `abp login username -p yourpassword`
  2. When prompted, type the password before pressing Enter
  3. In CI/automation, pipe the password or use -p flag, since the interactive prompt requires a TTY

Example fix

// before
abp login username
// then press Enter at the Password: prompt

// after
abp login username -p 'your-secure-password'
Defensive patterns

Strategy: validation

Validate before calling

// Ensure password is provided or the environment supports interactive prompting
var password = commandLineArgs.Options.GetOrNull(Options.Password.Short, Options.Password.Long);
var isInteractive = !Console.IsInputRedirected; // has a TTY
if (string.IsNullOrWhiteSpace(password) && !isInteractive)
{
    Console.Error.WriteLine("Error: Password required via -p in non-interactive environments.");
    return;
}

Try / catch

try
{
    await loginCommand.ExecuteAsync(commandLineArgs);
}
catch (CliUsageException ex) when (ex.Message.Contains("Password is missing"))
{
    logger.LogError("Password is required. Pass via -p or type it at the prompt.");
}

Prevention

When it happens

Trigger: Running `abp login username` without -p, then pressing Enter without typing a password at the 'Password:' prompt. ReadSecret() returns an empty/whitespace string, triggering IsNullOrWhiteSpace().

Common situations: User accidentally presses Enter at the password prompt, or a non-interactive environment (CI, piped input) where no password is supplied via stdin or -p flag. Also occurs when password managers fail to inject the password.

Related errors


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