{"record":{"id":"2053a09474d43d3b","repo":"abpframework/abp","slug":"failed-to-deserialize-the-created-storage-zone-res","errorCode":null,"errorMessage":"Failed to deserialize the created storage zone response for '{containerName}'","messagePattern":"Failed to deserialize the created storage zone response for '(.+?)'","errorType":"exception","errorClass":"AbpException","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.BlobStoring.Bunny/Volo/Abp/BlobStoring/Bunny/DefaultBunnyClientFactory.cs","lineNumber":131,"sourceCode":"\n            var response = await client.PostAsync(\n                \"https://api.bunny.net/storagezone\",\n                content);\n\n            if (!response.IsSuccessStatusCode)\n            {\n                var errorContent = await response.Content.ReadAsStringAsync();\n                throw new AbpException(\n                    $\"Failed to create storage zone '{containerName}'. \" +\n                    $\"Status: {response.StatusCode}, Error: {errorContent}\");\n            }\n\n            var responseContent = await response.Content.ReadAsStringAsync();\n            var createdZone = JsonSerializer.Deserialize<BunnyStorageZoneModel>(responseContent);\n\n            if (createdZone == null)\n            {\n                throw new AbpException($\"Failed to deserialize the created storage zone response for '{containerName}'\");\n            }\n\n            return createdZone;\n        }\n    }\n\n    protected virtual async Task<BunnyStorageZoneModel?> GetStorageZoneAsync(string accessKey, string containerName)\n    {\n        using (var client = _httpClientFactory.CreateClient(\"BunnyApiClient\"))\n        {\n            client.DefaultRequestHeaders.Add(\"AccessKey\", accessKey);\n            var response = await client.GetAsync(\"https://api.bunny.net/storagezone\");\n            response.EnsureSuccessStatusCode();\n\n            var content = await response.Content.ReadAsStringAsync();\n            var zones = JsonSerializer.Deserialize<BunnyStorageZoneModel[]>(content);\n\n            return zones?.FirstOrDefault(x => x.Name.Equals(containerName, StringComparison.OrdinalIgnoreCase) && !x.Deleted);","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.BlobStoring.Bunny/Volo/Abp/BlobStoring/Bunny/DefaultBunnyClientFactory.cs#L113-L149","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// The zone likely exists server-side; switch off auto-create and reuse it\n\"Bunny\": {\n  \"AccessKey\": \"<key>\",\n  \"ContainerName\": \"my-zone\",\n  \"CreateContainerIfNotExists\": false\n}","handlingStrategy":"try-catch","validationCode":"// Prefer pre-existing zones to avoid relying on response deserialization:\nconfiguration.CreateContainerIfNotExists = false;\n// ensure the zone already exists in Bunny before operating","typeGuard":"bool reliesOnAutoCreate = configuration.CreateContainerIfNotExists; // this error only occurs during auto-create","tryCatchPattern":"try { await container.SaveAsync(blobName, stream); }\ncatch (AbpException ex) when (ex.Message.Contains(\"Failed to deserialize\"))\n{\n    // zone may exist server-side; check Bunny dashboard, then disable auto-create\n    configuration.CreateContainerIfNotExists = false;\n}","preventionTips":["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."],"tags":["bunny","storage-zone","deserialization","api","abp"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}