{"record":{"id":"9f2f423306a0edcf","repo":"hashicorp/nomad","slug":"task-s-not-found-in-allocation-s","errorCode":null,"errorMessage":"task %s not found in allocation %s","messagePattern":"task (.+?) not found in allocation (.+?)","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"client/alloc_endpoint.go","lineNumber":308,"sourceCode":"\t\treturn nil, nstructs.ErrPermissionDenied\n\t}\n\n\t// Validate the arguments\n\tif req.Task == \"\" {\n\t\treturn new(int64(400)), taskNotPresentErr\n\t}\n\n\tif req.JobID != \"\" && req.JobID != alloc.JobID {\n\t\treturn new(int64(http.StatusBadRequest)),\n\t\t\tfmt.Errorf(\"job %s does not have allocation %s\", req.JobID, req.AllocID)\n\t}\n\n\t// If an action is present, go find the command and args\n\tif req.Action != \"\" {\n\t\ttask := alloc.LookupTask(req.Task)\n\t\tif task == nil {\n\t\t\treturn new(int64(http.StatusBadRequest)),\n\t\t\t\tfmt.Errorf(\"task %s not found in allocation %s\", req.Task, alloc.ID)\n\t\t}\n\t\tjobAction := task.GetAction(req.Action)\n\t\tif jobAction == nil {\n\t\t\treturn new(int64(http.StatusBadRequest)),\n\t\t\t\tfmt.Errorf(\"action %s not found in task %s\", req.Action, req.Task)\n\t\t}\n\n\t\t// append both Command and Args\n\t\treq.Cmd = append([]string{jobAction.Command}, jobAction.Args...)\n\t}\n\n\tif len(req.Cmd) == 0 {\n\t\treturn new(int64(400)), errors.New(\"command is not present\")\n\t}\n\n\tcapabilities, err := ar.GetTaskDriverCapabilities(req.Task)\n\tif err != nil {\n\t\tcode := new(int64(500))","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/alloc_endpoint.go#L290-L326","documentation":"Returned by the client exec endpoint when an action is requested: the named task exists in the request but alloc.LookupTask cannot find it inside the allocation, meaning the task name does not belong to that allocation.","triggerScenarios":"Thrown at client/alloc_endpoint.go:308 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["List the tasks in the allocation's task group and use an exact task name","Check task name spelling and case","Confirm the allocation belongs to the expected job/group"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}