apache/druid · error · WebApplicationException

Cannot find any task with id: [%s]

Error message

Cannot find any task with id: [%s]

What it means

TaskResourceFilter throws this 404 when the task id taken from the request path does not exist in the task storage used by the overlord. It validates the id format first, then looks the task up via TaskQueryTool; a missing record means there is nothing to authorize or serve. This is the standard 'unknown task id' response for task REST endpoints.

Source

Thrown at indexing-service/src/main/java/org/apache/druid/indexing/overlord/http/security/TaskResourceFilter.java:81

  @Override
  public ContainerRequest filter(ContainerRequest request)
  {
    String taskId = Preconditions.checkNotNull(
        request.getPathSegments()
               .get(
                   Iterables.indexOf(
                       request.getPathSegments(),
                       input -> "task".equals(input.getPath())
                   ) + 1
               ).getPath()
    );

    IdUtils.validateId("taskId", taskId);

    Optional<Task> taskOptional = taskQueryTool.getTask(taskId);
    if (!taskOptional.isPresent()) {
      throw new WebApplicationException(
          Response.status(Response.Status.NOT_FOUND)
                  .type(MediaType.TEXT_PLAIN)
                  .entity(StringUtils.format("Cannot find any task with id: [%s]", taskId))
                  .build()
      );
    }
    final String dataSourceName = Preconditions.checkNotNull(taskOptional.get().getDataSource());

    final ResourceAction resourceAction = new ResourceAction(
        new Resource(dataSourceName, ResourceType.DATASOURCE),
        getAction(request)
    );

    final AuthorizationResult authResult = AuthorizationUtils.authorizeResourceAction(
        getReq(),
        resourceAction,
        getAuthorizerMapper()
    );

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Verify the exact id via GET /druid/indexer/v1/tasks (it matches what was returned at submit time)
  2. Confirm the overlord's metadata.storage.type/connectURI matches the store the task was submitted to
  3. If the task completed long ago, query historical task data instead of the live endpoint
  4. Re-submit the task if it was never stored due to a submit failure

Example fix

// before
curl http://overlord:8081/druid/indexer/v1/task/index_wiki_2026-09-01T00:00:00.000Z/status
// after: use the id returned by the submit response
curl -X POST .../druid/indexer/v1/task | jq '.task'
curl http://overlord:8081/druid/indexer/v1/task/index_wiki_2026-09-01T00:00:00.000Z/status
Defensive patterns

Strategy: validation

Validate before calling

const tasks = await (await fetch(`${overlord}/druid/indexer/v1/tasks`)).json();
if (!tasks.some(t => t.id === taskId)) throw new Error(`unknown task: ${taskId}`);

Type guard

function taskExists(list, id) { return Array.isArray(list) && list.some(t => t.id === id); }

Try / catch

try { ... } catch (e) { if (e.status === 404) { /* treat as completed/pruned task */ } else throw e; }

Prevention

When it happens

Trigger: Any task REST call (GET /druid/indexer/v1/task/<id>, /status, /log, /shutdown) where <id> is not a stored task, or where the request is routed to an overlord that does not share the same metadata store.

Common situations: Typo or truncated task id; task already completed and pruned/cleaned from the metadata store; overlord pointed at a different metadata database; high-availability setup where tasks live in another cluster's store.

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/b5af271b4784ffc0. Report an issue: GitHub.