abpframework/abp · error · AbpException

Could not retrieve storage zone information for container '{

Error message

Could not retrieve storage zone information for container '{containerName}'

What it means

Thrown by DefaultBunnyClientFactory.CreateAsync as a defensive post-cache null check when GetOrAddAsync returns a null storageZoneInfo without the value-factory having thrown. Because the value-factory itself throws AbpException when GetStorageZoneAsync returns null (see error 54), reaching this line implies the cache returned a previously-stored null or an unexpected cache behavior. It is a belt-and-suspenders guard against a null slipping through to BunnyCDNStorage construction.

Source

Thrown at framework/src/Volo.Abp.BlobStoring.Bunny/Volo/Abp/BlobStoring/Bunny/DefaultBunnyClientFactory.cs:59

                var result = await GetStorageZoneAsync(accessKey, containerName);
                if (result == null)
                {
                    throw new AbpException($"Storage zone '{containerName}' not found");
                }

                // Encrypt the sensitive password before caching
                result.Password = _stringEncryptionService.Encrypt(result.Password!)!;
                return result;
            },
            () => new DistributedCacheEntryOptions
            {
                AbsoluteExpiration = DateTimeOffset.Now.Add(CacheDuration)
            }
        );

        if (storageZoneInfo == null)
        {
            throw new AbpException($"Could not retrieve storage zone information for container '{containerName}'");
        }

        // Decrypt the password before using it
        var decryptedPassword = _stringEncryptionService.Decrypt(storageZoneInfo.Password);

        return new BunnyCDNStorage(containerName, decryptedPassword, region);
    }

    public virtual async Task EnsureStorageZoneExistsAsync(
        string accessKey,
        string containerName,
        string region = "de",
        bool createIfNotExists = false)
    {
        var storageZone = await GetStorageZoneAsync(accessKey, containerName);

        if (storageZone == null)
        {

View on GitHub (pinned to 7ed43b1931)

Solutions

  1. Clear the distributed cache entry for key 'BunnyStorageZone:{containerName}'.
  2. Verify the storage zone exists and the access key is valid (the value-factory should then succeed and cache a real value).
  3. Check that no external process is writing null into the Bunny storage-zone cache key.
  4. Restart the application to repopulate the cache.

Example fix

// Mitigation: clear stale cache and retry
var cacheKey = $"BunnyStorageZone:{containerName}";
await distributedCache.RemoveAsync(cacheKey);
await container.SaveAsync(blobName, stream); // repopulates cache
Defensive patterns

Strategy: try-catch

Validate before calling

// Mitigate a corrupted null cache entry by clearing it before retry:
var cacheKey = $"BunnyStorageZone:{containerName}";
await distributedCache.RemoveAsync(cacheKey);

Type guard

// This error is a defensive guard; reaching it implies an anomalous cache state.

Try / catch

try { await container.SaveAsync(blobName, stream); }
catch (AbpException ex) when (ex.Message.Contains("Could not retrieve storage zone information"))
{
    await distributedCache.RemoveAsync($"BunnyStorageZone:{containerName}");
    await container.SaveAsync(blobName, stream); // repopulates cache
}

Prevention

When it happens

Trigger: GetOrAddAsync returns null for storageZoneInfo, which can happen if a null entry was cached externally or the distributed cache implementation returns null unexpectedly without invoking the factory. In normal operation the factory throws first, so this is rarely hit.

Common situations: Corrupted or manually-injected null cache entry for the BunnyStorageZone:{containerName} key, a custom IDistributedCache implementation returning null, or a race where the cache entry was evicted/invalidated between factory run and read.

Related errors


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