{"record":{"id":"a75468469d7b0ebb","repo":"apache/druid","slug":"cannot-find-taskgroup-s-among-all-activelyreadi","errorCode":null,"errorMessage":"Cannot find taskGroup [%s] among all activelyReadingTaskGroups [%s]","messagePattern":"Cannot find taskGroup \\[(.+?)\\] among all activelyReadingTaskGroups \\[(.+?)\\]","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java","lineNumber":987,"sourceCode":"      }\n    }\n\n    boolean isValidTaskGroup(int taskGroupId, @Nullable TaskGroup taskGroup)\n    {\n      if (taskGroup == null) {\n        // taskGroup might be in pendingCompletionTaskGroups or partitionGroups\n        if (pendingCompletionTaskGroups.containsKey(taskGroupId)) {\n          log.warn(\n              \"Ignoring checkpoint request because taskGroup[%d] has already stopped indexing and is waiting for \"\n              + \"publishing segments\",\n              taskGroupId\n          );\n          return false;\n        } else if (partitionGroups.containsKey(taskGroupId)) {\n          log.warn(\"Ignoring checkpoint request because taskGroup[%d] is inactive\", taskGroupId);\n          return false;\n        } else {\n          throw new ISE(\"Cannot find taskGroup [%s] among all activelyReadingTaskGroups [%s]\", taskGroupId,\n                        activelyReadingTaskGroups\n          );\n        }\n      }\n\n      return true;\n    }\n\n    @Override\n    public String getType()\n    {\n      return TYPE;\n    }\n  }\n\n  // Map<{group id}, {actively reading task group}>; see documentation for TaskGroup class\n  private final ConcurrentHashMap<Integer, TaskGroup> activelyReadingTaskGroups = new ConcurrentHashMap<>();\n","sourceCodeStart":969,"sourceCodeEnd":1005,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java#L969-L1005","documentation":"The supervisor's checkpoint validation (called for each checkpoint request) resolves the taskGroupId from the checkpoint request and looks it up in activelyReadingTaskGroups. If the id maps into partitionGroups (an inactive/finished group) it ignores the request; if it is entirely unknown, an ISE is thrown because a checkpoint cannot be applied to a group the supervisor is not actively reading with.","triggerScenarios":"A task POSTs a checkpoint whose taskGroupId no longer exists in activelyReadingTaskGroups — the group was killed/replaced (e.g. after a pause/stop, segment handoff, or supervisor restart) between the task starting and the checkpoint arriving.","commonSituations":"Race between task checkpoint requests and supervisor task-group replacement; stale tasks still running after the supervisor recycled the group; supervisor restart losing in-memory task-group state while old tasks keep running.","solutions":["Check whether the task referenced is stale; kill it so it stops sending checkpoints","Restart the supervisor or the affected tasks so task group state and running tasks are consistent","Ensure supervisor dataSources/early publishing is not prematurely removing task groups; check handoff timing"],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"if (!supervisor.getActivelyReadingTaskGroups().containsKey(taskGroupId)) {\n  log.warn(\"Task group %s no longer active; skipping checkpoint\", taskGroupId);\n  return;\n}","typeGuard":null,"tryCatchPattern":"try {\n  supervisor.checkpoint(taskGroupId, metadata);\n} catch (IllegalStateException e) {\n  if (e.getMessage().contains(\"Cannot find taskGroup\")) {\n    // group was recycled; treat checkpoint as no-op and let tasks restart\n  } else throw e;\n}","preventionTips":["Kill stale tasks promptly so they stop sending checkpoints","Avoid supervisor restarts mid-sequence when possible","Monitor handoff/pause timing that recycles task groups"],"tags":["checkpoint","supervisor","race-condition"],"backgroundTag":"entity-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"}