apache/druid · error · RuntimeException
Failed to delete google cloud storage object from bucket [%s
Error message
Failed to delete google cloud storage object from bucket [%s] and path [%s].
What it means
GoogleDataSegmentKiller.deleteIfPresent checks whether a GCS object exists and deletes it. StorageExceptions are deliberately rethrown so callers can apply retry semantics, but any other unexpected exception (e.g. InvalidRequest, client-side errors) is wrapped in a RuntimeException with the bucket and path for diagnosis.
Source
Thrown at extensions-core/google-extensions/src/main/java/org/apache/druid/storage/google/GoogleDataSegmentKiller.java:89
}
catch (StorageException e) {
throw new SegmentLoadingException(e, "Couldn't kill segment[%s]: [%s]", segment.getId(), e.getMessage());
}
}
private void deleteIfPresent(String bucket, String path)
{
try {
GoogleUtils.retryGoogleCloudStorageOperation(() -> {
storage.delete(bucket, path);
return null;
});
}
catch (StorageException e) {
throw e;
}
catch (Exception e) {
throw new RE(e, "Failed to delete google cloud storage object from bucket [%s] and path [%s].", bucket, path);
}
}
@Override
public void killAll() throws IOException
{
if (accountConfig.getBucket() == null || accountConfig.getPrefix() == null) {
throw new ISE(
"Cannot delete all segment files from Google Deep Storage since druid.google.bucket and druid.google.prefix are not both set.");
}
LOG.info(
"Deleting all segment files from gs location [bucket: '%s' prefix: '%s']",
accountConfig.getBucket(),
accountConfig.getPrefix()
);
try {
GoogleUtils.deleteObjectsInPath(
storage,View on GitHub (pinned to 9b90983fd2)
Solutions
- Check the wrapped cause (e.getCause()) to find the real client-side error
- Validate segment object paths are well-formed GCS object names
- Confirm StorageException handling covers the transient case you expected (it is rethrown, not wrapped)
- Fix segment metadata if the stored path is malformed
Defensive patterns
Strategy: try-catch
Validate before calling
// Ensure object name is valid GCS key before delete
if (path.startsWith("/") || path.contains("//")) throw new IllegalArgumentException("malformed GCS path: " + path); Try / catch
try { killer.kill(segment); } catch (RuntimeException e) { LOGGER.error(e.getCause(), "deleteIfPresent failed for bucket/path"); throw e; } Prevention
- Validate segment object paths when producing metadata
- Inspect getCause() for non-StorageException client errors
- Keep segment paths free of illegal GCS characters
When it happens
Trigger: kill() calling deleteIfPresent for index.json or descriptor.json when the GCS client throws a non-StorageException error, e.g. IllegalArgumentException from an invalid object name, or an unchecked error from the response processing (blob.getResponse() handling).
Common situations: Segment paths containing characters GCS rejects; corrupted segment metadata producing malformed paths; bugs in custom retry/listener code around the GCS client.
Related errors
- Invalid input file path [%s]
- Couldn't kill segment[%s]: [%s]
- Cannot delete all segment files from Google Deep Storage sin
- Failed to upload [%s] to [%s]
- Failed to fetch google cloud storage object from bucket [%s]
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/b45d5a1c2899b071.
Report an issue: GitHub.