hashicorp/nomad · error
JobID required for actions
Error message
JobID required for actions
What it means
Job.GetActions was called with an empty JobID. The endpoint validates arguments after ACL checks and requires a job ID to scope the actions query, rejecting the request with 'JobID required for actions'.
Source
Thrown at nomad/job_endpoint.go:1727
if done, err := j.srv.forward(structs.JobGetActionsRPCMethod, args, args, reply); done {
return err
}
j.srv.MeasureRPCRate("job", structs.RateMetricRead, args)
if authErr != nil {
return structs.ErrPermissionDenied
}
defer metrics.MeasureSince([]string{"nomad", "job", "get_actions"}, time.Now())
// Check for read-job permissions
if aclObj, err := j.srv.ResolveACL(args); err != nil {
return err
} else if !aclObj.AllowNsOp(args.RequestNamespace(), acl.NamespaceCapabilityReadJob) {
return structs.ErrPermissionDenied
}
// Validate the arguments
if args.JobID == "" {
return fmt.Errorf("JobID required for actions")
}
// Grab the job
job, err := j.srv.fsm.State().JobByID(nil, args.RequestNamespace(), args.JobID)
if err != nil {
return err
}
if job == nil {
return structs.NewErrUnknownJob(args.JobID)
}
// Get its task groups' tasks' actions
jobActions := make([]*structs.JobAction, 0)
for _, tg := range job.TaskGroups {
for _, task := range tg.Tasks {
for _, action := range task.Actions {
jobAction := &structs.JobAction{
Action: *action,View on GitHub (pinned to 482b49bf1a)
Solutions
- Populate JobID (the request's job field) before calling GetActions.
- Ensure the UI/route always carries the job name/id as a path parameter.
- Validate non-empty JobID client-side to fail early with a clear message.
- Confirm you intended a job-scoped call, not a namespace-wide listing endpoint.
Example fix
// before
actions, _, err := client.Jobs().GetActions("", nil)
// after
if jobID == "" { return errors.New("GetActions needs a job ID") }
actions, _, err := client.Jobs().GetActions(jobID, nil) Defensive patterns
Strategy: validation
Validate before calling
if jobID == "" {
return fmt.Errorf("GetActions requires a job ID")
}
actions, _, err := client.Jobs().GetActions(jobID, nil) Type guard
func hasJobID(id string) bool { return id != "" } Prevention
- Always plumb the job name/id through UI routes into actions requests.
- Check for unset CLI flags or env vars before constructing the request.
- Add an integration test that asserts non-empty job IDs in action queries.
When it happens
Trigger: GET /v1/job//actions or an ActionsRequest with args.JobID == "" (caller has ReadJob ACL but supplies no ID), at nomad/job_endpoint.go:1727.
Common situations: Dashboard/UI code navigating to an actions endpoint without a selected job; API wrappers omitting the path parameter; CI scripts with an unset job-name variable.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- missing job ID
- Job required for plan
- missing node ID
- Missing allocation ID
- Filter expression cannot be used with other filter parameter
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/4d3822421e80500a.
Report an issue: GitHub.