abpframework/abp · error · AbpException

Container name must be between {MinLength} and {MaxLength} c

Error message

Container name must be between {MinLength} and {MaxLength} characters. Current length: {normalizedName.Length}

What it means

Thrown by BunnyBlobNamingNormalizer.NormalizeContainerName when the normalized container name length is outside the allowed range [MinLength=4, MaxLength=64]. The check runs after character normalization, so the measured length is the post-strip length. Bunny storage-zone names must be 4-64 characters of lowercase letters, digits, and hyphens.

Source

Thrown at framework/src/Volo.Abp.BlobStoring.Bunny/Volo/Abp/BlobStoring/Bunny/BunnyBlobNamingNormalizer.cs:43

            var normalizedName = containerName
                .Trim()
                .ToLowerInvariant();

            // Remove any invalid characters
            normalizedName = Regex.Replace(normalizedName, "[^a-z0-9-]", string.Empty);

            // Validate structure
            if (!ValidCharactersRegex.IsMatch(normalizedName))
            {
                throw new AbpException(
                    $"Container name contains invalid characters: {containerName}. " +
                    "Only lowercase letters, numbers, and hyphens are allowed.");
            }

            // Validate length
            if (normalizedName.Length < MinLength || normalizedName.Length > MaxLength)
            {
                throw new AbpException(
                    $"Container name must be between {MinLength} and {MaxLength} characters. " +
                    $"Current length: {normalizedName.Length}");
            }

            return normalizedName;
        }
    }
}

View on GitHub (pinned to 7ed43b1931)

Solutions

  1. Choose a container name between 4 and 64 characters using only lowercase letters, digits, and hyphens.
  2. If the original name loses characters during normalization, pick a name already in the valid alphabet so its length is stable.
  3. Set an explicit ContainerName in the Bunny configuration within the allowed range.

Example fix

// before
"Bunny": { "ContainerName": "ab" }

// after
"Bunny": { "ContainerName": "app-media" }
Defensive patterns

Strategy: validation

Validate before calling

const int Min = 4, Max = 64;
if (containerName.Length < Min || containerName.Length > Max)
    throw new ArgumentException($"Container name length must be {Min}-{Max}.");

Type guard

static bool IsValidBunnyContainerLength(string name) => name.Length >= 4 && name.Length <= 64;

Try / catch

try { NormalizeContainerName(name); }
catch (AbpException ex) when (ex.Message.Contains("between"))
{ /* choose a name within 4-64 chars */ }

Prevention

When it happens

Trigger: A Bunny container name that, after trim/lowercase/strip, is shorter than 4 or longer than 64 characters. Triggered on the first blob operation that normalizes the container name.

Common situations: A too-short container name like 'ab' or 'app', an overly long generated name, or a container name that lost many characters during the invalid-character strip and fell below the minimum.

Related errors


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