{"record":{"id":"67dbfd751d27824b","repo":"hashicorp/nomad","slug":"task-not-found","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":1482,"sourceCode":"\t}()\n\n\tselect {\n\tcase <-waitCh:\n\tcase <-ctx.Done():\n\t}\n\n\treturn err.ErrorOrNil()\n}\n\n// Signal sends a signal request to task runners inside an allocation. If the\n// taskName is empty, then it is sent to all tasks.\nfunc (ar *allocRunner) Signal(taskName, signal string) error {\n\tevent := structs.NewTaskEvent(structs.TaskSignaling).SetSignalText(signal)\n\n\tif taskName != \"\" {\n\t\ttr, ok := ar.tasks[taskName]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"Task not found\")\n\t\t}\n\n\t\treturn tr.Signal(event, signal)\n\t}\n\n\tvar err *multierror.Error\n\n\tfor tn, tr := range ar.tasks {\n\t\trerr := tr.Signal(event.Copy(), signal)\n\t\tif rerr != nil {\n\t\t\terr = multierror.Append(err, fmt.Errorf(\"Failed to signal task: %s, err: %v\", tn, rerr))\n\t\t}\n\t}\n\n\treturn err.ErrorOrNil()\n}\n\n// Reconnect logs a reconnect event for each task in the allocation and syncs the current alloc state with the server.","sourceCodeStart":1464,"sourceCodeEnd":1500,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/allocrunner/alloc_runner.go#L1464-L1500","documentation":"allocRunner.Signal returns this when asked to send a signal to a task whose name does not exist in the allocation's task map. It is a client-side lookup failure: the task name passed to the Signal API does not match any task defined in the allocation's task group. Nomad throws it to prevent signaling a non-existent task.","triggerScenarios":"Calling Client.Allocations().Signal(allocID, taskName, signal) with a taskName that is empty-check passed but does not match any task in ar.tasks (e.g. typo, task restarted under a different name, or signaling an alloc from a different group).","commonSituations":"Typoed task name in a script or CI job; hardcoding a task name that changed after a job spec edit; signaling a task in the wrong allocation (alloc belongs to a different group); race where the alloc was updated and the task name no longer exists.","solutions":["Verify the task name with `nomad alloc status <alloc-id>` and use the exact name from the Task list","Confirm the allocation ID belongs to the task group containing the target task","If signaling all tasks, omit the taskName (pass empty string) so Signal iterates every task","Update any hardcoded task names in job files/scripts after job spec changes"],"exampleFix":"// before\nclient.Allocations().Signal(ctx, allocID, \"sidecar\", \"SIGUSR1\")\n// after\nalloc, _, _ := client.Allocations().Info(ctx, allocID, nil)\ntaskName := alloc.TaskGroup // check `nomad alloc status` for exact task names\ncount, _, _ := alloc.TaskGroup\n_ = count\nclient.Allocations().Signal(ctx, allocID, \"envoy-sidecar\", \"SIGUSR1\")","handlingStrategy":"validation","validationCode":"alloc, _, err := client.Allocations().Info(ctx, allocID, nil)\nif err != nil { return err }\nfound := false\nfor _, t := range alloc.TaskStates { if t.Name == taskName { found = true } }\nif !found { return fmt.Errorf(\"task %q not present in alloc %s\", taskName, allocID) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always resolve task names from `nomad alloc status` or the alloc's TaskStates, never hardcode","Re-fetch the allocation after job updates before signaling","Pass empty taskName to signal all tasks when you don't need per-task targeting"],"tags":["nomad","client","signal","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"}