apache/druid · error · SegmentLoadingException
Couldn't kill segment[%s]: [%s]
Error message
Couldn't kill segment[%s]: [%s]
What it means
Thrown when emptying the Azure blob directory that holds a segment fails with a BlobStorageException during kill(). The segment ID and Azure error message are included so the operator can diagnose the storage-side failure.
Source
Thrown at extensions-core/azure-extensions/src/main/java/org/apache/druid/storage/azure/AzureDataSegmentKiller.java:128
}
}
@Override
public void kill(DataSegment segment) throws SegmentLoadingException
{
log.info("Killing segment [%s]", segment);
Map<String, Object> loadSpec = segment.getLoadSpec();
final String containerName = MapUtils.getString(loadSpec, "containerName");
final String blobPath = MapUtils.getString(loadSpec, "blobPath");
final String dirPath = Paths.get(blobPath).getParent().toString();
try {
azureStorage.emptyCloudBlobDirectory(containerName, dirPath);
}
catch (BlobStorageException e) {
throw new SegmentLoadingException(e, "Couldn't kill segment[%s]: [%s]", segment.getId(), e.getMessage());
}
}
@Override
public void killAll() throws IOException
{
if (segmentConfig.getContainer() == null || segmentConfig.getPrefix() == null) {
throw new ISE(
"Cannot delete all segment files since Azure Deep Storage since druid.azure.container and druid.azure.prefix are not both set.");
}
log.info(
"Deleting all segment files from Azure storage location [bucket: '%s' prefix: '%s']",
segmentConfig.getContainer(),
segmentConfig.getPrefix()
);
try {
AzureUtils.deleteObjectsInPath(
azureStorage,View on GitHub (pinned to 9b90983fd2)
Solutions
- Read e.getMessage() in the exception to identify the Azure status code
- Grant the account delete permission on the container/blob path
- Verify the segment's container still exists and the path matches druid.azure.container/prefix
- Disable or account for blob immutability policies/soft-delete if kills must hard-delete
Example fix
// before
catch (BlobStorageException e) {
throw new SegmentLoadingException(e, "Couldn't kill segment[%s]: [%s]", segment.getId(), e.getMessage());
}
// after
catch (BlobStorageException e) {
if (e.getStatusCode() == 404) { return; } // already gone
throw new SegmentLoadingException(e, "Couldn't kill segment[%s]: [%s]", segment.getId(), e.getMessage());
} Defensive patterns
Strategy: try-catch
Validate before calling
if (!blobContainerExists(containerName)) throw new IllegalStateException("Container " + containerName + " does not exist"); Try / catch
try { killer.kill(segment); } catch (SegmentLoadingException e) { Throwable cause = e.getCause(); if (cause instanceof BlobStorageException bse && bse.getStatusCode() == 404) return; throw e; } Prevention
- Handle 404 as success (segment already gone)
- Check storage account immutability/soft-delete policies before large kill campaigns
- Use SAS tokens with delete scope
- Log the Azure request id from BlobStorageException for support tickets
When it happens
Trigger: azureStorage.emptyCloudBlobDirectory(containerName, dirPath) throws BlobStorageException: e.g. the directory's blobs are immutable/leased, credentials lack delete permission, or the container no longer exists.
Common situations: Killing a segment after its container was deleted; RBAC/SAS token without blob delete; soft-delete enabled in the storage account causing 409 conflicts.
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
- Couldn't delete segments from Azure. See the task logs for m
- Unauthorized
- Recoverable exception
- NoSuchElementException
- Failed to get blob item from Azure container[%s], prefix[%s
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/b9bbd093b112fb58.
Report an issue: GitHub.