abpframework/abp · error · ArgumentException

{parameterName} length must be equal to or bigger than {minL

Error message

{parameterName} length must be equal to or bigger than {minLength}!

What it means

The minLength branch of Check.NotNull(string) fires when minLength > 0 and value.Length < minLength. It enforces minimum-length invariants such as password strength, code format, or fixed-width identifiers at the boundary.

Source

Thrown at framework/src/Volo.Abp.Core/Volo/Abp/Check.cs:57

    public static string NotNull(
        [System.Diagnostics.CodeAnalysis.NotNull] string? value,
        [InvokerParameterName][NotNull] string parameterName,
        int maxLength = int.MaxValue,
        int minLength = 0)
    {
        if (value == null)
        {
            throw new ArgumentException($"{parameterName} can not be null!", parameterName);
        }

        if (value.Length > maxLength)
        {
            throw new ArgumentException($"{parameterName} length must be equal to or lower than {maxLength}!", parameterName);
        }

        if (minLength > 0 && value.Length < minLength)
        {
            throw new ArgumentException($"{parameterName} length must be equal to or bigger than {minLength}!", parameterName);
        }

        return value;
    }

    [ContractAnnotation("value:null => halt")]
    public static string NotNullOrWhiteSpace(
        [System.Diagnostics.CodeAnalysis.NotNull] string? value,
        [InvokerParameterName][NotNull] string parameterName,
        int maxLength = int.MaxValue,
        int minLength = 0)
    {
        if (value.IsNullOrWhiteSpace())
        {
            throw new ArgumentException($"{parameterName} can not be null, empty or white space!", parameterName);
        }

        if (value!.Length > maxLength)

View on GitHub (pinned to 7ed43b1931)

Solutions

  1. Ensure input meets the minimum length before calling.
  2. Lower minLength if the floor is wrong for the real data.
  3. Pad or reject short input at the caller if the value is user-supplied.

Example fix

// before
Check.NotNull(code, nameof(code), minLength: 10); // throws if <10

// after
Check.NotNull(code.PadRight(10), nameof(code), minLength: 10);
Defensive patterns

Strategy: validation

Validate before calling

if (value is null || value.Length < minLength)
    throw new ArgumentOutOfRangeException(nameof(value));
Check.NotNull(value, nameof(value), minLength: minLength);

Type guard

bool MeetsMin(string s, int min) => s.Length >= min;

Prevention

When it happens

Trigger: Check.NotNull(value, nameof(value), minLength: 8) with a value shorter than 8 characters; an ABP guard with a minimum-length invariant receiving short input.

Common situations: Password / token validation below the floor; short codes; user input that must meet a minimum width.

Related errors


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