apache/druid · error · IllegalStateException

Cannot find taskGroup

Error message

Cannot find taskGroup [%s] among all activelyReadingTaskGroups [%s]

What it means

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.

Solutions

  1. Check whether the task referenced is stale; kill it so it stops sending checkpoints
  2. Restart the supervisor or the affected tasks so task group state and running tasks are consistent
  3. Ensure supervisor dataSources/early publishing is not prematurely removing task groups; check handoff timing

Example fix

null
Defensive patterns

Strategy: try-catch

Validate before calling

if (!supervisor.getActivelyReadingTaskGroups().containsKey(taskGroupId)) {
  log.warn("Task group %s no longer active; skipping checkpoint", taskGroupId);
  return;
}

Try / catch

try {
  supervisor.checkpoint(taskGroupId, metadata);
} catch (IllegalStateException e) {
  if (e.getMessage().contains("Cannot find taskGroup")) {
    // group was recycled; treat checkpoint as no-op and let tasks restart
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/a75468469d7b0ebb. Report an issue: GitHub.

Appendix: source

Thrown at indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java:987

      }
    }

    boolean isValidTaskGroup(int taskGroupId, @Nullable TaskGroup taskGroup)
    {
      if (taskGroup == null) {
        // taskGroup might be in pendingCompletionTaskGroups or partitionGroups
        if (pendingCompletionTaskGroups.containsKey(taskGroupId)) {
          log.warn(
              "Ignoring checkpoint request because taskGroup[%d] has already stopped indexing and is waiting for "
              + "publishing segments",
              taskGroupId
          );
          return false;
        } else if (partitionGroups.containsKey(taskGroupId)) {
          log.warn("Ignoring checkpoint request because taskGroup[%d] is inactive", taskGroupId);
          return false;
        } else {
          throw new ISE("Cannot find taskGroup [%s] among all activelyReadingTaskGroups [%s]", taskGroupId,
                        activelyReadingTaskGroups
          );
        }
      }

      return true;
    }

    @Override
    public String getType()
    {
      return TYPE;
    }
  }

  // Map<{group id}, {actively reading task group}>; see documentation for TaskGroup class
  private final ConcurrentHashMap<Integer, TaskGroup> activelyReadingTaskGroups = new ConcurrentHashMap<>();

View on GitHub (pinned to 9b90983fd2)