{"record":{"id":"6c9309becb6ba252","repo":"abpframework/abp","slug":"could-not-retrieve-storage-zone-information-for-co","errorCode":null,"errorMessage":"Could not retrieve storage zone information for container '{containerName}'","messagePattern":"Could not retrieve storage zone information for container '(.+?)'","errorType":"exception","errorClass":"AbpException","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.BlobStoring.Bunny/Volo/Abp/BlobStoring/Bunny/DefaultBunnyClientFactory.cs","lineNumber":59,"sourceCode":"                var result = await GetStorageZoneAsync(accessKey, containerName);\n                if (result == null)\n                {\n                    throw new AbpException($\"Storage zone '{containerName}' not found\");\n                }\n\n                // Encrypt the sensitive password before caching\n                result.Password = _stringEncryptionService.Encrypt(result.Password!)!;\n                return result;\n            },\n            () => new DistributedCacheEntryOptions\n            {\n                AbsoluteExpiration = DateTimeOffset.Now.Add(CacheDuration)\n            }\n        );\n\n        if (storageZoneInfo == null)\n        {\n            throw new AbpException($\"Could not retrieve storage zone information for container '{containerName}'\");\n        }\n\n        // Decrypt the password before using it\n        var decryptedPassword = _stringEncryptionService.Decrypt(storageZoneInfo.Password);\n\n        return new BunnyCDNStorage(containerName, decryptedPassword, region);\n    }\n\n    public virtual async Task EnsureStorageZoneExistsAsync(\n        string accessKey,\n        string containerName,\n        string region = \"de\",\n        bool createIfNotExists = false)\n    {\n        var storageZone = await GetStorageZoneAsync(accessKey, containerName);\n\n        if (storageZone == null)\n        {","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.BlobStoring.Bunny/Volo/Abp/BlobStoring/Bunny/DefaultBunnyClientFactory.cs#L41-L77","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Clear the distributed cache entry for key 'BunnyStorageZone:{containerName}'.","Verify the storage zone exists and the access key is valid (the value-factory should then succeed and cache a real value).","Check that no external process is writing null into the Bunny storage-zone cache key.","Restart the application to repopulate the cache."],"exampleFix":"// Mitigation: clear stale cache and retry\nvar cacheKey = $\"BunnyStorageZone:{containerName}\";\nawait distributedCache.RemoveAsync(cacheKey);\nawait container.SaveAsync(blobName, stream); // repopulates cache","handlingStrategy":"try-catch","validationCode":"// Mitigate a corrupted null cache entry by clearing it before retry:\nvar cacheKey = $\"BunnyStorageZone:{containerName}\";\nawait distributedCache.RemoveAsync(cacheKey);","typeGuard":"// This error is a defensive guard; reaching it implies an anomalous cache state.","tryCatchPattern":"try { await container.SaveAsync(blobName, stream); }\ncatch (AbpException ex) when (ex.Message.Contains(\"Could not retrieve storage zone information\"))\n{\n    await distributedCache.RemoveAsync($\"BunnyStorageZone:{containerName}\");\n    await container.SaveAsync(blobName, stream); // repopulates cache\n}","preventionTips":["Do not externally write null into the BunnyStorageZone: cache keys.","Clear the distributed cache if this defensive error appears.","Ensure the underlying IDistributedCache behaves per contract."],"tags":["bunny","storage-zone","cache","configuration","abp"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}