Skip to content

[BUG] DeleteIfExistsAsync throws RequestFailedException with 400 when blob does not exist #53796

@nlriverty

Description

@nlriverty

Library name and version

Azure.Storage.Blobs 12.24.1

Describe the bug

When running this code, the request repeatedly fails:

public async Task DeleteAsync(string url)
    {
        var containerName = _blobStorageSettings.AttachmentsContainerName;
        var blobServiceClient = new BlobServiceClient(_blobStorageSettings.MalwareScanEnabled.ConnectionString);
        var sourceClient = blobServiceClient.GetBlobContainerClient(containerName).GetBlobClient(url);
        await sourceClient.DeleteIfExistsAsync(DeleteSnapshotsOption.IncludeSnapshots);
    }

The url in question is 6509eb0e-ed4f-4d94-0d07-08de1d4a6876/Gmail - =04 Bedankt voor je bestelling!_thumbnail.jpg

Error details:

The requested URI does not represent any resource on the server. RequestId:35eabfd8-901e-0036-7c20-5280aa000000 Time:2025-11-10T08:59:49.8875716Z Status: 400 (The requested URI does not represent any resource on the server.) ErrorCode: InvalidUri Content:  InvalidUriThe requested URI does not represent any resource on the server. RequestId:35eabfd8-901e-0036-7c20-5280aa000000 Time:2025-11-10T08:59:49.8875716Z Headers: Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 x-ms-error-code: InvalidUri x-ms-request-id: 35eabfd8-901e-0036-7c20-5280aa000000 x-ms-version: 2025-05-05 Date: Mon, 10 Nov 2025 08:59:49 GMT Content-Length: 244 Content-Type: application/xml

 


at Azure.Storage.Blobs.BlobRestClient.DeleteAsync(String snapshot, String versionId, Nullable`1 timeout, String leaseId, Nullable`1 deleteSnapshots, Nullable`1 ifModifiedSince, Nullable`1 ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, Nullable`1 blobDeleteType, CancellationToken cancellationToken) at Azure.Storage.Blobs.Specialized.BlobBaseClient.DeleteInternal(DeleteSnapshotsOption snapshotsOption, BlobRequestConditions conditions, Boolean async, CancellationToken cancellationToken, String operationName) at Azure.Storage.Blobs.Specialized.BlobBaseClient.DeleteIfExistsInternal(DeleteSnapshotsOption snapshotsOption, BlobRequestConditions conditions, Boolean async, CancellationToken cancellationToken) at Azure.Storage.Blobs.Specialized.BlobBaseClient.DeleteIfExistsAsync(DeleteSnapshotsOption snapshotsOption, BlobRequestConditions conditions, CancellationToken cancellationToken)

Expected behavior

I expect the request to always succeed, as we only care that the blob does not exist after processing.

Actual behavior

The request repeatedly fails. It is possible that the blob never existed in the first place.

Reproduction Steps

I'm not sure what's special about this case. It has been running in production for many months and this is the first time I have seen this issue.

Environment

dotnet 9 on linux - alpine-minirootfs-3.22.2-x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    ClientThis issue is related to a non-management packageService AttentionWorkflow: This issue is responsible by Azure service team.StorageStorage Service (Queues, Blobs, Files)customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions