{"record":{"id":"a89f83a8f0bc6c3f","repo":"hashicorp/nomad","slug":"alloc-missing-task-group","errorCode":null,"errorMessage":"alloc missing task group","messagePattern":"alloc missing task group","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/allocrunner/taskrunner/task_runner.go","lineNumber":464,"sourceCode":"\n\t// Pull out the task's resources\n\tif tr.alloc.AllocatedResources == nil {\n\t\treturn nil, fmt.Errorf(\"no task resources found on allocation\")\n\t}\n\n\tif _, ok := tr.alloc.AllocatedResources.Tasks[tr.taskName]; !ok {\n\t\treturn nil, fmt.Errorf(\"no task resources found on allocation\")\n\t}\n\n\ttr.taskResources = tr.alloc.AllocatedResources.Tasks[tr.taskName].Copy()\n\n\t// Build the restart tracker.\n\trp := config.Task.RestartPolicy\n\tif rp == nil {\n\t\ttg := tr.alloc.Job.LookupTaskGroup(tr.alloc.TaskGroup)\n\t\tif tg == nil {\n\t\t\ttr.logger.Error(\"alloc missing task group\")\n\t\t\treturn nil, fmt.Errorf(\"alloc missing task group\")\n\t\t}\n\t\trp = tg.RestartPolicy\n\t}\n\ttr.restartTracker = restarts.NewRestartTracker(rp, tr.alloc.Job.Type, config.Task.Lifecycle)\n\n\t// Get the driver\n\tif err := tr.initDriver(); err != nil {\n\t\ttr.logger.Error(\"failed to create driver\", \"error\", err)\n\t\treturn nil, err\n\t}\n\n\t// Use the client secret only as the initial value; the identity hook will\n\t// update this with a workload identity if one is available\n\ttr.setNomadToken(config.ClientConfig.Node.SecretID)\n\n\t// Initialize the runners hooks. Must come after initDriver so hooks\n\t// can use tr.driverCapabilities\n\ttr.initHooks()","sourceCodeStart":446,"sourceCodeEnd":482,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/allocrunner/taskrunner/task_runner.go#L446-L482","documentation":"TaskRunner setup guard: tr.alloc.Job.LookupTaskGroup(tr.alloc.TaskGroup) returned nil while building the restart policy, meaning the allocation references a task group absent from its job - treated as corrupt alloc state and aborts task setup.","triggerScenarios":"Thrown at client/allocrunner/taskrunner/task_runner.go:464 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Report as a bug; indicates alloc/job state mismatch on the client","Check whether the alloc was restored from partial state","Restart the client to re-sync alloc state from servers"],"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"}