{"record":{"id":"c3e52805e2ef99e2","repo":"abpframework/abp","slug":"error-while-checking-blob-existence-ex-message","errorCode":null,"errorMessage":"Error while checking blob existence: {ex.Message}","messagePattern":"Error while checking blob existence: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.BlobStoring.Bunny/Volo/Abp/BlobStoring/Bunny/BunnyBlobProvider.cs","lineNumber":123,"sourceCode":"        {\n            var fullBlobPath = $\"/{containerName}/{blobName}\";\n            var directoryPath = Path.GetDirectoryName(fullBlobPath)?.Replace('\\\\', '/') + \"/\";\n\n            if (string.IsNullOrWhiteSpace(directoryPath))\n            {\n                throw new Exception(\"Invalid directory path generated from blob name.\");\n            }\n\n            var objects = await bunnyStorage.GetStorageObjectsAsync(directoryPath);\n            return objects?.Any(o => o.FullPath == fullBlobPath) == true;\n        }\n        catch (BunnyCDNStorageException ex) when (ex.Message.Contains(\"404\"))\n        {\n            return false;\n        }\n        catch (Exception ex)\n        {\n            throw new Exception($\"Error while checking blob existence: {ex.Message}\", ex);\n        }\n    }\n\n    protected virtual async Task<BunnyCDNStorage> GetBunnyCDNStorageAsync(BlobProviderArgs args)\n    {\n        var configuration = args.Configuration.GetBunnyConfiguration();\n        var containerName = GetContainerName(args);\n        var region = configuration.Region ?? \"de\";\n\n        return await BunnyClientFactory.CreateAsync(\n            configuration.AccessKey,\n            containerName,\n            region);\n    }\n\n    protected virtual string GetContainerName(BlobProviderArgs args)\n    {\n        var configuration = args.Configuration.GetBunnyConfiguration();","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.BlobStoring.Bunny/Volo/Abp/BlobStoring/Bunny/BunnyBlobProvider.cs#L105-L141","documentation":"Thrown by BunnyBlobProvider.BlobExistsAsync as a catch-all wrapper around any non-404 exception that occurs while listing storage objects (GetStorageObjectsAsync) to determine blob existence. The original exception is preserved as InnerException and its Message is embedded. BunnyCDNStorageException messages containing '404' are treated as 'does not exist' (return false) and are not wrapped.","triggerScenarios":"Any error during the Bunny GetStorageObjectsAsync call that is not a 404: network failures, authentication errors, 5xx responses, malformed responses, or SDK-internal exceptions. The wrapper converts these into a single Exception so callers see a uniform 'Error while checking blob existence' failure.","commonSituations":"Transient network blips, expired/invalid Bunny access keys, Bunny API rate limiting, or a changed Bunny SDK response shape that breaks deserialization. Surfaces on Save/Delete/Exists/Get since all path through BlobExistsAsync.","solutions":["Inspect InnerException for the root cause (network, auth, deserialization).","Retry transient network failures with backoff.","Verify the Bunny AccessKey and that the storage zone is reachable.","If the inner error is a Bunny API/schema change, update the Bunny CDN SDK package."],"exampleFix":"// before\nvar exists = await container.ExistsAsync(name);\n\n// after\nbool exists;\ntry\n{\n    exists = await container.ExistsAsync(name);\n}\ncatch (Exception ex) when (ex.Message.Contains(\"Error while checking blob existence\"))\n{\n    _logger.LogWarning(ex, \"Bunny existence check failed; treating as retryable\");\n    exists = await retryPolicy.ExecuteAsync(() => container.ExistsAsync(name));\n}","handlingStrategy":"try-catch","validationCode":"// No pre-call guard for arbitrary network failures; instead verify config:\nif (configuration.AccessKey.IsNullOrWhiteSpace())\n    throw new InvalidOperationException(\"Bunny AccessKey is not configured.\");","typeGuard":"bool bunnyConfigured = !configuration.AccessKey.IsNullOrWhiteSpace();","tryCatchPattern":"try { await container.ExistsAsync(blobName); }\ncatch (Exception ex) when (ex.Message.Contains(\"Error while checking blob existence\"))\n{\n    var root = ex.InnerException?.Message ?? ex.Message;\n    // branch on root: retry for network, fix key for auth\n    await retryPolicy.ExecuteAsync(() => container.ExistsAsync(blobName));\n}","preventionTips":["Always inspect InnerException to find the true cause.","Retry transient network/5xx errors with exponential backoff.","Keep the Bunny AccessKey valid and the SDK version current."],"tags":["bunny","blob-storage","network","existence-check","abp"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}