abpframework/abp · error · AbpException
Failed to create storage zone '{containerName}'. Status: {re
Error message
Failed to create storage zone '{containerName}'. Status: {response.StatusCode}, Error: {errorContent} What it means
Thrown by DefaultBunnyClientFactory.CreateStorageZoneAsync when the POST to https://api.bunny.net/storagezone returns a non-success status code. The AbpException embeds the HTTP status code and the raw error body read from the response. This occurs during auto-creation (CreateContainerIfNotExists=true) when the Bunny API rejects the zone-creation request.
Source
Thrown at framework/src/Volo.Abp.BlobStoring.Bunny/Volo/Abp/BlobStoring/Bunny/DefaultBunnyClientFactory.cs:121
{
{ "Name", containerName },
{ "Region", region },
{ "ZoneTier", 0 }
};
var content = new StringContent(
JsonSerializer.Serialize(payload),
Encoding.UTF8,
"application/json");
var response = await client.PostAsync(
"https://api.bunny.net/storagezone",
content);
if (!response.IsSuccessStatusCode)
{
var errorContent = await response.Content.ReadAsStringAsync();
throw new AbpException(
$"Failed to create storage zone '{containerName}'. " +
$"Status: {response.StatusCode}, Error: {errorContent}");
}
var responseContent = await response.Content.ReadAsStringAsync();
var createdZone = JsonSerializer.Deserialize<BunnyStorageZoneModel>(responseContent);
if (createdZone == null)
{
throw new AbpException($"Failed to deserialize the created storage zone response for '{containerName}'");
}
return createdZone;
}
}
protected virtual async Task<BunnyStorageZoneModel?> GetStorageZoneAsync(string accessKey, string containerName)
{View on GitHub (pinned to 7ed43b1931)
Solutions
- Read the Status and Error in the message: 401 -> fix AccessKey; duplicate -> the zone already exists (remove CreateContainerIfNotExists or reuse it); billing -> resolve account limits.
- Verify the AccessKey has storage-zone creation permissions.
- Ensure the region is one Bunny accepts.
- Retry transient 5xx failures with backoff.
Example fix
// Diagnose from the embedded status/error, then:
// - 401: correct AccessKey
// - duplicate name: zone exists, set CreateContainerIfNotExists=false and use existing zone
"Bunny": {
"AccessKey": "<valid-account-key>",
"ContainerName": "my-zone",
"CreateContainerIfNotExists": false
} Defensive patterns
Strategy: try-catch
Validate before calling
// Verify the key can manage storage zones before enabling auto-create:
if (configuration.AccessKey.IsNullOrWhiteSpace())
throw new InvalidOperationException("Bunny AccessKey required to create a zone."); Type guard
bool canCreateZone = configuration.CreateContainerIfNotExists && !configuration.AccessKey.IsNullOrWhiteSpace();
Try / catch
try { await container.SaveAsync(blobName, stream); }
catch (AbpException ex) when (ex.Message.Contains("Failed to create storage zone"))
{
// parse embedded Status/Error: 401->key, duplicate->reuse, billing->account
} Prevention
- Use an account-level AccessKey with storage-zone creation rights.
- Avoid duplicate zone names; reuse existing zones when present.
- Parse the embedded HTTP status to drive the fix.
When it happens
Trigger: CreateStorageZoneAsync posts a payload {Name, Region, ZoneTier:0}; if Bunny returns non-2xx (e.g. 401 unauthorized, 400 duplicate name, 402 billing limit), the exception is raised with the status and error content.
Common situations: Invalid or expired AccessKey (401), a storage zone with that name already exists (409/400), account billing limits reached, an unsupported region value, or transient Bunny API errors.
Related errors
- Failed to validate storage zone '{containerName}': {ex.Messa
- Failed to deserialize the created storage zone response for
- Error while checking blob existence: {ex.Message}
- Storage zone '{containerName}' not found
- Could not retrieve storage zone information for container '{
AI-assisted analysis of abpframework/abp@7ed43b1931 (2026-08-13).
Data as JSON: /api/errors/047ab47ea28d1175.
Report an issue: GitHub.