{"record":{"id":"7589251051550933","repo":"apache/druid","slug":"told-to-remove-non-existant-segment-s","errorCode":null,"errorMessage":"Told to remove non-existant segment[%s]","messagePattern":"Told to remove non-existant segment\\[(.+?)\\]","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/src/main/java/org/apache/druid/client/CoordinatorServerView.java","lineNumber":231,"sourceCode":"      }\n\n      segmentLoadInfo.addServer(server);\n\n      // segment added notification\n      runTimelineCallbacks(callback -> callback.segmentAdded(server, segment));\n    }\n  }\n\n  private void serverRemovedSegment(DruidServerMetadata server, DataSegment segment)\n  {\n    SegmentId segmentId = segment.getId();\n\n    synchronized (lock) {\n      log.debug(\"Removing segment[%s] from server[%s].\", segmentId, server);\n\n      final SegmentLoadInfo segmentLoadInfo = segmentLoadInfos.get(segmentId);\n      if (segmentLoadInfo == null) {\n        log.warn(\"Told to remove non-existant segment[%s]\", segmentId);\n        return;\n      }\n\n      if (segmentLoadInfo.removeServer(server)) {\n        // server segment removed notification\n        runTimelineCallbacks(callback -> callback.serverSegmentRemoved(server, segment));\n      }\n\n      if (segmentLoadInfo.isEmpty()) {\n        VersionedIntervalTimeline<String, SegmentLoadInfo> timeline = timelines.get(segment.getDataSource());\n        segmentLoadInfos.remove(segmentId);\n\n        final PartitionChunk<SegmentLoadInfo> removedPartition = timeline.remove(\n            segment.getInterval(), segment.getVersion(), segment.getShardSpec().createChunk(\n                new SegmentLoadInfo(\n                    segment\n                )\n            )","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/client/CoordinatorServerView.java#L213-L249","documentation":"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.","triggerScenarios":"DruidServer/segment removal callbacks (segmentRemoved, removeServer) delivering a segmentRemove event for a segment never added, or already removed, on that server.","commonSituations":"Race between segment-announce and segment-unannounce during historical restarts, duplicate zookeeper/http inventory events, coordinator failover replaying stale segment events.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// caller-side check before firing removal\nif (serverView.getSegmentLoadInfo(segmentId) == null) { log.info(\"segment %s not tracked; skipping remove\", segmentId); return; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["cluster","segment-lifecycle","timeline"],"backgroundTag":"record-not-found","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}