{"record":{"id":"cffab1dc91666785","repo":"hashicorp/nomad","slug":"task-group-q-doesn-t-exist-or-it-has-no-allocatio","errorCode":null,"errorMessage":"task group %q doesn't exist or it has no allocations","messagePattern":"task group %q doesn't exist or it has no allocations","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/alloc_fs.go","lineNumber":400,"sourceCode":"\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error querying job %q: %w\", jobID, err)\n\t}\n\n\t// Check that the job actually has allocations\n\tif len(allocs) == 0 {\n\t\treturn nil, fmt.Errorf(\"job %q doesn't exist or it has no allocations\", jobID)\n\t}\n\n\tif taskGroupName != \"\" {\n\t\tvar filteredAllocs []*api.AllocationListStub\n\t\tfor _, alloc := range allocs {\n\t\t\tif alloc.TaskGroup == taskGroupName {\n\t\t\t\tfilteredAllocs = append(filteredAllocs, alloc)\n\t\t\t}\n\t\t}\n\t\tallocs = filteredAllocs\n\t\tif len(allocs) == 0 {\n\t\t\treturn nil, fmt.Errorf(\"task group %q doesn't exist or it has no allocations\", taskGroupName)\n\t\t}\n\t}\n\n\tfor _, v := range allocs {\n\t\tif v.ClientStatus == \"running\" {\n\t\t\trunningAllocs = append(runningAllocs, v)\n\t\t}\n\t}\n\t// If we don't have any allocations running, use dead allocations\n\tif len(runningAllocs) < 1 {\n\t\trunningAllocs = allocs\n\t}\n\n\tr := rand.New(rand.NewSource(time.Now().UnixNano()))\n\talloc := runningAllocs[r.Intn(len(runningAllocs))]\n\n\treturn alloc, err\n}","sourceCodeStart":382,"sourceCodeEnd":418,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/alloc_fs.go#L382-L418","documentation":"Validation error in getRandomJobAlloc: after filtering the job's allocations by the given task group, none match, so the named task group either doesn't exist in the job or its allocations have all been stopped.","triggerScenarios":"Thrown at command/alloc_fs.go:400 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the task group name spelling with nomad job status <job>","Omit the task group filter to use any allocation of the job","Use a job that has live allocations in the requested task 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"}