apache/druid · warning

Unexpected exception occurred when deleting from container [

Error message

Unexpected exception occurred when deleting from container [%s], the following keys [%s]

What it means

AzureStorage.batchDeleteFiles() catches any unexpected Exception (beyond the Azure-specific blob batch exceptions) during a chunked batch delete, sets hadException, and logs this warning. The generic catch exists so one unexpected client error does not abort the whole deletion loop; a StorageException is thrown at the end because hadException is set.

Source

Thrown at extensions-core/azure-extensions/src/main/java/org/apache/druid/storage/azure/AzureStorage.java:298

        // We have to call forEach on the response because this is the only way azure batch will throw an exception on an operation failure.
        blobBatchClient.deleteBlobs(chunkOfKeys, DeleteSnapshotsOptionType.INCLUDE).forEach(response -> LOG.debug(
            "Deleting blob with URL %s completed with status code %d%n",
            response.getRequest().getUrl(),
            response.getStatusCode()
        ));
      }
      catch (BlobStorageException | BlobBatchStorageException e) {
        hadException = true;
        LOG.noStackTrace().warn(
            e,
            "Unable to delete from container [%s], the following keys [%s]",
            containerName,
            chunkOfKeys
        );
      }
      catch (Exception e) {
        hadException = true;
        LOG.noStackTrace().warn(
            e,
            "Unexpected exception occurred when deleting from container [%s], the following keys [%s]",
            containerName,
            chunkOfKeys
        );
      }
    }

    return !hadException;
  }

  /**
   * See {@link AzureStorage#getBlockBlobExists(String, String, Integer)} for details.
   */
  public boolean getBlockBlobExists(final String container, final String blobName) throws BlobStorageException
  {
    return getBlockBlobExists(container, blobName, null);
  }

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Check the logged stack trace for the unexpected exception's root cause
  2. Verify Azure SDK dependency versions match the Druid extension's expectations (no shaded-jar conflicts)
  3. Retry the deletion — batches are idempotent
  4. If a specific key always triggers it, delete that key individually to isolate it
  5. Report persistent SDK-level failures with the exception stack to the Druid community
Defensive patterns

Strategy: retry

Validate before calling

// pin the correct azure-storage-blob version on the classpath
mvn dependency:tree | grep azure-storage-blob

Try / catch

try {
  storage.batchDeleteFiles(container, keys);
} catch (StorageException e) {
  log.error(e, "batch delete failed; see prior warnings for failing key chunk");
  retryWithBackoff(() -> storage.batchDeleteFiles(container, keys));
}

Prevention

When it happens

Trigger: Any non-BlobStorageException runtime error thrown by the Azure SDK (e.g., IllegalStateException from the batch builder, deserialization issues in responses, or an unexpected SDK bug) while deleting a chunk of keys.

Common situations: Incompatible azure-storage-blob SDK versions on the classpath; batch containing malformed keys; client-side bugs or OOM during large batch assembly.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/5d4c63decf5b0785. Report an issue: GitHub.