{"record":{"id":"b5af271b4784ffc0","repo":"apache/druid","slug":"cannot-find-any-task-with-id-s","errorCode":null,"errorMessage":"Cannot find any task with id: [%s]","messagePattern":"Cannot find any task with id: \\[(.+?)\\]","errorType":"http","errorClass":"WebApplicationException","httpStatus":404,"severity":"error","filePath":"indexing-service/src/main/java/org/apache/druid/indexing/overlord/http/security/TaskResourceFilter.java","lineNumber":81,"sourceCode":"\n  @Override\n  public ContainerRequest filter(ContainerRequest request)\n  {\n    String taskId = Preconditions.checkNotNull(\n        request.getPathSegments()\n               .get(\n                   Iterables.indexOf(\n                       request.getPathSegments(),\n                       input -> \"task\".equals(input.getPath())\n                   ) + 1\n               ).getPath()\n    );\n\n    IdUtils.validateId(\"taskId\", taskId);\n\n    Optional<Task> taskOptional = taskQueryTool.getTask(taskId);\n    if (!taskOptional.isPresent()) {\n      throw new WebApplicationException(\n          Response.status(Response.Status.NOT_FOUND)\n                  .type(MediaType.TEXT_PLAIN)\n                  .entity(StringUtils.format(\"Cannot find any task with id: [%s]\", taskId))\n                  .build()\n      );\n    }\n    final String dataSourceName = Preconditions.checkNotNull(taskOptional.get().getDataSource());\n\n    final ResourceAction resourceAction = new ResourceAction(\n        new Resource(dataSourceName, ResourceType.DATASOURCE),\n        getAction(request)\n    );\n\n    final AuthorizationResult authResult = AuthorizationUtils.authorizeResourceAction(\n        getReq(),\n        resourceAction,\n        getAuthorizerMapper()\n    );","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/indexing-service/src/main/java/org/apache/druid/indexing/overlord/http/security/TaskResourceFilter.java#L63-L99","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the exact id via GET /druid/indexer/v1/tasks (it matches what was returned at submit time)","Confirm the overlord's metadata.storage.type/connectURI matches the store the task was submitted to","If the task completed long ago, query historical task data instead of the live endpoint","Re-submit the task if it was never stored due to a submit failure"],"exampleFix":"// before\ncurl http://overlord:8081/druid/indexer/v1/task/index_wiki_2026-09-01T00:00:00.000Z/status\n// after: use the id returned by the submit response\ncurl -X POST .../druid/indexer/v1/task | jq '.task'\ncurl http://overlord:8081/druid/indexer/v1/task/index_wiki_2026-09-01T00:00:00.000Z/status","handlingStrategy":"validation","validationCode":"const tasks = await (await fetch(`${overlord}/druid/indexer/v1/tasks`)).json();\nif (!tasks.some(t => t.id === taskId)) throw new Error(`unknown task: ${taskId}`);","typeGuard":"function taskExists(list, id) { return Array.isArray(list) && list.some(t => t.id === id); }","tryCatchPattern":"try { ... } catch (e) { if (e.status === 404) { /* treat as completed/pruned task */ } else throw e; }","preventionTips":["Store task ids from submit responses rather than reconstructing them","Confirm both overlords share the same metadata store in HA setups","Don't assume tasks remain queryable forever; completed tasks may be cleaned"],"tags":["http","rest-api","druid-overlord","tasks"],"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-14T05:17:10.506Z"}