apache/druid · warning
Asked to remove data segment that doesn't exist!? server
Error message
Asked to remove data segment that doesn't exist!? server[%s], segment[%s]
What it means
In removeDataSegment, when the data source exists but contains no segment matching the given id, dataSource.removeSegment returns null and this warning is logged; currSize/totalSegments are left untouched. Removal is a no-op and the returned removed segment is null.
Solutions
- Check for duplicate segmentRemove events in coordinator/inventory logs
- Ensure the segment's add event completed (announced and synced) before its removal
- Ignore one-off warnings after historical restarts; investigate repeats for the same segment id
- If size accounting looks wrong, restart the view process to rebuild from a full server inventory sync
Defensive patterns
Strategy: validation
Validate before calling
if (server.getSegment(segmentId) == null) { log.info("segment absent; skip removal"); return null; } Prevention
- Deduplicate removal events by segment id
- Confirm segment announcement before drop
- Treat post-restart warnings as transient noise
- Reconcile totalSegments periodically
When it happens
Trigger: removeSegment called with a segment id not present in that DruidServer's data source — duplicate removal, or removal before the add was processed.
Common situations: Race between segment load and drop, duplicated unannounce events, coordinator retrying a drop the view already handled.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- Asked to add data segment that already exists!? server
- Asked to remove data segment from a data source that…
- Asked to remove timeline entry
- Told to remove non-existant segment
- I'm being asked to become leader. But I am already the…
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/d4db14c454db8760.
Report an issue: GitHub.
Appendix: source
Thrown at server/src/main/java/org/apache/druid/client/DruidServer.java:330
(dataSourceName, dataSource) -> {
if (dataSource == null) {
log.warn(
"Asked to remove data segment from a data source that doesn't exist!? server[%s], segment[%s]",
getName(),
segmentId
);
// Returning null from the lambda here makes the ConcurrentHashMap to not record any entry.
return null;
}
DataSegment removed = dataSource.removeSegment(segmentId);
if (removed != null) {
segmentRemoved[0] = removed;
// Use effectiveSizeOf (loadedBytes when the value is a DataSegmentAndLoadProfile, else segment size)
// so the books balance against what we added.
currSize.addAndGet(-DataSegmentAndLoadProfile.effectiveSizeOf(removed));
totalSegments.decrementAndGet();
} else {
log.warn("Asked to remove data segment that doesn't exist!? server[%s], segment[%s]", getName(), segmentId);
}
// Returning null from the lambda here makes the ConcurrentHashMap to remove the current entry.
return dataSource.isEmpty() ? null : dataSource;
}
);
return segmentRemoved[0];
}
public DruidDataSource getDataSource(String dataSource)
{
return dataSources.get(dataSource);
}
public Collection<DruidDataSource> getDataSources()
{
return dataSources.values();
}
View on GitHub (pinned to 9b90983fd2)