{"record":{"id":"1bc8d2af58f41de8","repo":"hashicorp/nomad","slug":"task-not-found-1bc8d2","errorCode":null,"errorMessage":"task not found","messagePattern":"task not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/allocrunner/alloc_runner.go","lineNumber":1548,"sourceCode":"\t// Broadcast client alloc to listeners.\n\terr = ar.allocBroadcaster.Send(alloc)\n\n\treturn\n}\n\nfunc (ar *allocRunner) GetTaskExecHandler(taskName string) drivermanager.TaskExecHandler {\n\ttr, ok := ar.tasks[taskName]\n\tif !ok {\n\t\treturn nil\n\t}\n\n\treturn tr.TaskExecHandler()\n}\n\nfunc (ar *allocRunner) GetTaskDriverCapabilities(taskName string) (*drivers.Capabilities, error) {\n\ttr, ok := ar.tasks[taskName]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"task not found\")\n\t}\n\n\treturn tr.DriverCapabilities()\n}\n\n// AcknowledgeState is called by the client's alloc sync when a given client\n// state has been acknowledged by the server\nfunc (ar *allocRunner) AcknowledgeState(a *state.State) {\n\tar.stateLock.Lock()\n\tdefer ar.stateLock.Unlock()\n\tar.lastAcknowledgedState = a\n\tar.persistLastAcknowledgedState(a)\n}\n\n// persistLastAcknowledgedState stores the last client state acknowledged by the server\nfunc (ar *allocRunner) persistLastAcknowledgedState(a *state.State) {\n\tif err := ar.stateDB.PutAcknowledgedState(ar.id, a); err != nil {\n\t\t// While any persistence errors are very bad, the worst case scenario","sourceCodeStart":1530,"sourceCodeEnd":1566,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/allocrunner/alloc_runner.go#L1530-L1566","documentation":"allocRunner.GetTaskDriverCapabilities returns this when the requested taskName is not present in the allocation's task map. The caller (usually an internal exec/task-API path) asked for the driver capabilities of a task that does not exist in this allocation.","triggerScenarios":"Calling GetTaskDriverCapabilities (via the task exec / driver-capabilities lookup path) with a task name that doesn't match any task runner in ar.tasks.","commonSituations":"Internal exec sessions referencing a stale task name; tooling querying capabilities for a task after an in-place alloc update changed the task list; typo in task name when scripting against the task API.","solutions":["Check the exact task name via `nomad alloc status <alloc-id>`","Re-fetch the allocation after job updates to get the current task list","Ensure the allocation ID passed alongside the task name belongs to the right task group"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"alloc, _, err := client.Allocations().Info(ctx, allocID, nil)\nif err != nil { return err }\nif _, ok := alloc.TaskStates[taskName]; !ok {\n  return fmt.Errorf(\"task %q not in alloc %s\", taskName, allocID)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Look up task names from the current alloc snapshot, not cached data","Refresh alloc info after in-place updates that may change task lists"],"tags":["nomad","client","driver","task-not-found"],"backgroundTag":"task-not-found","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}