hashicorp/nomad · error
Allocation %q is running the following tasks: * %s Please
Error message
Allocation %q is running the following tasks: * %s Please specify the task.
What it means
When `nomad alloc logs` is pointed at an allocation running multiple tasks without a -task specified, Nomad cannot guess which task's logs to fetch. lookupAllocTask enumerates the job's task group and returns this error listing every task so the user can pick one.
Source
Thrown at command/alloc_logs.go:440
}
func lookupAllocTask(alloc *api.Allocation) (string, error) {
tg := alloc.Job.LookupTaskGroup(alloc.TaskGroup)
if tg == nil {
return "", fmt.Errorf("Could not find allocation task group: %s", alloc.TaskGroup)
}
if len(tg.Tasks) == 1 {
return tg.Tasks[0].Name, nil
}
var errStr strings.Builder
fmt.Fprintf(&errStr, "Allocation %q is running the following tasks:\n", limit(alloc.ID, shortId))
for _, t := range tg.Tasks {
fmt.Fprintf(&errStr, " * %s\n", t.Name)
}
fmt.Fprintf(&errStr, "\nPlease specify the task.")
return "", errors.New(errStr.String())
}
View on GitHub (pinned to 482b49bf1a)
Solutions
- Add the -task flag: `nomad alloc logs -task app <alloc-id>`.
- Run `nomad job inspect <job>` or `nomad alloc status <alloc>` to list the tasks first, then choose one.
- Update scripts to always pass -task when targeting multi-task job groups.
Example fix
// before $ nomad alloc logs 1f2b3c4d // after $ nomad alloc logs -task web 1f2b3c4d
Defensive patterns
Strategy: validation
Validate before calling
status, _, err := client.Allocations().Info(allocID, nil)
if err == nil && status.TaskGroup != "" {
job, _, _ := client.Jobs().Info(status.JobID, nil)
if job != nil && len(job.TaskGroups[0].Tasks) > 1 && taskFlag == "" {
return errors.New("multi-task alloc: pass -task")
}
} Try / catch
if err := allocLogs(); err != nil && strings.Contains(err.Error(), "Please specify the task") {
// parse listed task names from the error and re-run with -task
} Prevention
- Always pass -task for allocations from multi-task job groups.
- Use `nomad alloc status` to enumerate tasks before fetching logs.
- Parameterize task name in log-collection scripts.
When it happens
Trigger: Running `nomad alloc logs <alloc-id>` where the allocation's task group has more than one task and no -task flag is given.
Common situations: Multi-task jobs (sidecar + app), copy-pasted single-task-era commands, scripts that omit -task assuming one task per group.
Related errors
- both -n and -c set
- Group name required
- not a terminal
- Region not found
- evaluation ID or filter flag required
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/a50bf9090b370a2d.
Report an issue: GitHub.