apache/druid · warning
Told to remove non-existant segment
Error message
Told to remove non-existant segment[%s]
What it means
CoordinatorServerView.serverRemovedSegment logs a warning when it is asked to remove a segment from a server whose segmentLoadInfos map has no entry for that segment id. It is a benign consistency warning: the view state is already gone, so removal is a no-op; it does not throw for callers.
Solutions
- Verify the historical actually announced the segment before unannouncing (check its logs for segment announce events)
- Check inventory sync health: the HttpServerInventoryView must have processed the segmentAdd before remove
- If seen transiently during restarts, it is safe to ignore; investigate only if persistent for the same segment/server
- Confirm no duplicate server inventory viewers are configured pointing at the same server
Defensive patterns
Strategy: validation
Validate before calling
// caller-side check before firing removal
if (serverView.getSegmentLoadInfo(segmentId) == null) { log.info("segment %s not tracked; skipping remove", segmentId); return; } Prevention
- Ensure segment add events are processed before removals (inventory sync ordering)
- Watch for historical restart storms generating duplicate events
- Alert on this warning frequency; a burst usually signals event replay
- Keep a single server inventory view registration per process
When it happens
Trigger: DruidServer/segment removal callbacks (segmentRemoved, removeServer) delivering a segmentRemove event for a segment never added, or already removed, on that server.
Common situations: Race between segment-announce and segment-unannounce during historical restarts, duplicate zookeeper/http inventory events, coordinator failover replaying stale segment events.
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 remove timeline entry
- Asked to add data segment that already exists!? server
- Asked to remove data segment from a data source that…
- Asked to remove data segment that doesn't exist!? server
- key must be an instance of Interval
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/7589251051550933.
Report an issue: GitHub.
Appendix: source
Thrown at server/src/main/java/org/apache/druid/client/CoordinatorServerView.java:231
}
segmentLoadInfo.addServer(server);
// segment added notification
runTimelineCallbacks(callback -> callback.segmentAdded(server, segment));
}
}
private void serverRemovedSegment(DruidServerMetadata server, DataSegment segment)
{
SegmentId segmentId = segment.getId();
synchronized (lock) {
log.debug("Removing segment[%s] from server[%s].", segmentId, server);
final SegmentLoadInfo segmentLoadInfo = segmentLoadInfos.get(segmentId);
if (segmentLoadInfo == null) {
log.warn("Told to remove non-existant segment[%s]", segmentId);
return;
}
if (segmentLoadInfo.removeServer(server)) {
// server segment removed notification
runTimelineCallbacks(callback -> callback.serverSegmentRemoved(server, segment));
}
if (segmentLoadInfo.isEmpty()) {
VersionedIntervalTimeline<String, SegmentLoadInfo> timeline = timelines.get(segment.getDataSource());
segmentLoadInfos.remove(segmentId);
final PartitionChunk<SegmentLoadInfo> removedPartition = timeline.remove(
segment.getInterval(), segment.getVersion(), segment.getShardSpec().createChunk(
new SegmentLoadInfo(
segment
)
)View on GitHub (pinned to 9b90983fd2)