{"record":{"id":"40b0e5f69c854adb","repo":"apache/druid","slug":"ioexception-wrapping-underlying-cause","errorCode":null,"errorMessage":"IOException wrapping underlying cause","messagePattern":"IOException wrapping underlying cause","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"extensions-core/azure-extensions/src/main/java/org/apache/druid/storage/azure/AzureDataSegmentKiller.java","lineNumber":157,"sourceCode":"    log.info(\n        \"Deleting all segment files from Azure storage location [bucket: '%s' prefix: '%s']\",\n        segmentConfig.getContainer(),\n        segmentConfig.getPrefix()\n    );\n    try {\n      AzureUtils.deleteObjectsInPath(\n          azureStorage,\n          inputDataConfig,\n          accountConfig,\n          azureCloudBlobIterableFactory,\n          segmentConfig.getContainer(),\n          segmentConfig.getPrefix(),\n          Predicates.alwaysTrue()\n      );\n    }\n    catch (Exception e) {\n      log.error(\"Error occurred while deleting segment files from Azure. Error: %s\", e.getMessage());\n      throw new IOException(e);\n    }\n  }\n}\n","sourceCodeStart":139,"sourceCodeEnd":161,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/azure-extensions/src/main/java/org/apache/druid/storage/azure/AzureDataSegmentKiller.java#L139-L161","documentation":"After a failure while listing and deleting all segment blobs in killAll(), the error is logged and rethrown as an IOException wrapping the original exception. This preserves the cause chain for callers expecting IOException from the DataSegmentKiller interface.","triggerScenarios":"azureStorage.listAzureStorageObjects (or the delete of each blob) throws any Exception during killAll: auth failure, network error, throttling, or permission denial while enumerating/purging container contents.","commonSituations":"Container credentials lacking list/delete rights; transient Azure errors during large purges; container deleted mid-operation.","solutions":["Inspect the logged \"Error occurred while deleting segment files from Azure\" line and its cause for the Azure SDK error","Fix the underlying auth/permission/network issue and retry killAll","Wrap the call site in try/catch IOException and surface getCause() for diagnosis"],"exampleFix":"// before\ntry { killer.killAll(); } catch (IOException e) { log.error(e.getMessage()); }\n// after\ntry { killer.killAll(); } catch (IOException e) {\n  throw new RuntimeException(\"killAll failed\", e.getCause()); // preserve Azure cause\n}","handlingStrategy":"try-catch","validationCode":"try { azureStorage.listAzureStorageObjects(container, prefix, 1); } catch (Exception e) { throw new IllegalStateException(\"Azure not reachable/authorized: \" + e.getMessage()); }","typeGuard":null,"tryCatchPattern":"try { killer.killAll(); } catch (IOException e) { Throwable root = e.getCause(); log.error(\"killAll root cause: %s\", root, root); }","preventionTips":["Always inspect getCause() — the IOException message alone is useless","Confirm list+delete permissions before purging a container","Run large purges in batches to avoid long-running transient failures","Snapshot/metadata backup before mass deletion"],"tags":["azure","ioexception","deletion"],"backgroundTag":"file-write-failed","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"}