{"record":{"id":"5d4c63decf5b0785","repo":"apache/druid","slug":"unexpected-exception-occurred-when-deleting-from-c","errorCode":null,"errorMessage":"Unexpected exception occurred when deleting from container [%s], the following keys [%s]","messagePattern":"Unexpected exception occurred when deleting from container \\[(.+?)\\], the following keys \\[(.+?)\\]","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"extensions-core/azure-extensions/src/main/java/org/apache/druid/storage/azure/AzureStorage.java","lineNumber":298,"sourceCode":"        // We have to call forEach on the response because this is the only way azure batch will throw an exception on an operation failure.\n        blobBatchClient.deleteBlobs(chunkOfKeys, DeleteSnapshotsOptionType.INCLUDE).forEach(response -> LOG.debug(\n            \"Deleting blob with URL %s completed with status code %d%n\",\n            response.getRequest().getUrl(),\n            response.getStatusCode()\n        ));\n      }\n      catch (BlobStorageException | BlobBatchStorageException e) {\n        hadException = true;\n        LOG.noStackTrace().warn(\n            e,\n            \"Unable to delete from container [%s], the following keys [%s]\",\n            containerName,\n            chunkOfKeys\n        );\n      }\n      catch (Exception e) {\n        hadException = true;\n        LOG.noStackTrace().warn(\n            e,\n            \"Unexpected exception occurred when deleting from container [%s], the following keys [%s]\",\n            containerName,\n            chunkOfKeys\n        );\n      }\n    }\n\n    return !hadException;\n  }\n\n  /**\n   * See {@link AzureStorage#getBlockBlobExists(String, String, Integer)} for details.\n   */\n  public boolean getBlockBlobExists(final String container, final String blobName) throws BlobStorageException\n  {\n    return getBlockBlobExists(container, blobName, null);\n  }","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/azure-extensions/src/main/java/org/apache/druid/storage/azure/AzureStorage.java#L280-L316","documentation":"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.","triggerScenarios":"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.","commonSituations":"Incompatible azure-storage-blob SDK versions on the classpath; batch containing malformed keys; client-side bugs or OOM during large batch assembly.","solutions":["Check the logged stack trace for the unexpected exception's root cause","Verify Azure SDK dependency versions match the Druid extension's expectations (no shaded-jar conflicts)","Retry the deletion — batches are idempotent","If a specific key always triggers it, delete that key individually to isolate it","Report persistent SDK-level failures with the exception stack to the Druid community"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// pin the correct azure-storage-blob version on the classpath\nmvn dependency:tree | grep azure-storage-blob","typeGuard":null,"tryCatchPattern":"try {\n  storage.batchDeleteFiles(container, keys);\n} catch (StorageException e) {\n  log.error(e, \"batch delete failed; see prior warnings for failing key chunk\");\n  retryWithBackoff(() -> storage.batchDeleteFiles(container, keys));\n}","preventionTips":["Keep Azure SDK dependencies aligned with the Druid extension version","Delete suspicious keys individually to isolate batch failures","Capture the warning's key chunk for targeted retries","Report reproducible SDK exceptions upstream"],"tags":["azure","storage","deletion","unexpected-exception"],"backgroundTag":"api-error-response","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}