abpframework/abp · error · AbpException
Failed to deserialize the created storage zone response for
Error message
Failed to deserialize the created storage zone response for '{containerName}' What it means
Thrown by DefaultBunnyClientFactory.CreateStorageZoneAsync when the storage-zone creation POST succeeded (2xx) but JsonSerializer.Deserialize<BunnyStorageZoneModel> returned null for the response body. It indicates the Bunny API returned an unexpected or empty body that does not deserialize into the expected zone model. The exception names the containerName whose creation response could not be parsed.
Source
Thrown at framework/src/Volo.Abp.BlobStoring.Bunny/Volo/Abp/BlobStoring/Bunny/DefaultBunnyClientFactory.cs:131
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)
{
using (var client = _httpClientFactory.CreateClient("BunnyApiClient"))
{
client.DefaultRequestHeaders.Add("AccessKey", accessKey);
var response = await client.GetAsync("https://api.bunny.net/storagezone");
response.EnsureSuccessStatusCode();
var content = await response.Content.ReadAsStringAsync();
var zones = JsonSerializer.Deserialize<BunnyStorageZoneModel[]>(content);
return zones?.FirstOrDefault(x => x.Name.Equals(containerName, StringComparison.OrdinalIgnoreCase) && !x.Deleted);View on GitHub (pinned to 7ed43b1931)
Solutions
- Check the Bunny dashboard: the zone may already exist (creation succeeded); remove CreateContainerIfNotExists or point at the existing zone.
- Verify the BunnyStorageZoneModel matches the current Bunny API response schema; update the model/SDK if the API changed.
- Capture and inspect the raw response body to diagnose the schema mismatch.
- As a workaround, create the zone manually in the dashboard and disable auto-creation.
Example fix
// The zone likely exists server-side; switch off auto-create and reuse it
"Bunny": {
"AccessKey": "<key>",
"ContainerName": "my-zone",
"CreateContainerIfNotExists": false
} Defensive patterns
Strategy: try-catch
Validate before calling
// Prefer pre-existing zones to avoid relying on response deserialization: configuration.CreateContainerIfNotExists = false; // ensure the zone already exists in Bunny before operating
Type guard
bool reliesOnAutoCreate = configuration.CreateContainerIfNotExists; // this error only occurs during auto-create
Try / catch
try { await container.SaveAsync(blobName, stream); }
catch (AbpException ex) when (ex.Message.Contains("Failed to deserialize"))
{
// zone may exist server-side; check Bunny dashboard, then disable auto-create
configuration.CreateContainerIfNotExists = false;
} Prevention
- Create zones manually in the Bunny dashboard to avoid the auto-create path.
- Keep BunnyStorageZoneModel aligned with the current Bunny API response.
- Inspect the raw creation response body to diagnose schema drift.
When it happens
Trigger: A successful POST to the Bunny storagezone endpoint whose JSON body is empty, null, or structurally incompatible with BunnyStorageZoneModel, so the deserialized result is null. This breaks the auto-create flow after the zone is nominally created.
Common situations: Bunny API contract change altering the response shape, an empty 200/201 body, or a version mismatch between the expected BunnyStorageZoneModel and the actual API response. The zone may actually have been created server-side.
Related errors
- Failed to create storage zone '{containerName}'. Status: {re
- Failed to validate storage zone '{containerName}': {ex.Messa
- Storage zone '{containerName}' not found
- Could not retrieve storage zone information for container '{
- Storage zone '{containerName}' does not exist. Set createIfN
AI-assisted analysis of abpframework/abp@7ed43b1931 (2026-08-13).
Data as JSON: /api/errors/2053a09474d43d3b.
Report an issue: GitHub.