hashicorp/nomad · error

action %s not found in task %s

Error message

action %s not found in task %s

What it means

Returned by the client exec endpoint after the task was resolved: task.GetAction could not find the requested action name among the task's defined actions, so there is no command to run.

Source

Thrown at client/alloc_endpoint.go:313

		return new(int64(400)), taskNotPresentErr
	}

	if req.JobID != "" && req.JobID != alloc.JobID {
		return new(int64(http.StatusBadRequest)),
			fmt.Errorf("job %s does not have allocation %s", req.JobID, req.AllocID)
	}

	// If an action is present, go find the command and args
	if req.Action != "" {
		task := alloc.LookupTask(req.Task)
		if task == nil {
			return new(int64(http.StatusBadRequest)),
				fmt.Errorf("task %s not found in allocation %s", req.Task, alloc.ID)
		}
		jobAction := task.GetAction(req.Action)
		if jobAction == nil {
			return new(int64(http.StatusBadRequest)),
				fmt.Errorf("action %s not found in task %s", req.Action, req.Task)
		}

		// append both Command and Args
		req.Cmd = append([]string{jobAction.Command}, jobAction.Args...)
	}

	if len(req.Cmd) == 0 {
		return new(int64(400)), errors.New("command is not present")
	}

	capabilities, err := ar.GetTaskDriverCapabilities(req.Task)
	if err != nil {
		code := new(int64(500))
		if nstructs.IsErrUnknownAllocation(err) {
			code = new(int64(404))
		}

		return code, err

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. List the actions defined on the task in the job spec and use an exact action name
  2. Check action name spelling
  3. Update the job spec if the action was renamed or removed
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at client/alloc_endpoint.go:313 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/98881fc5503b6d84. Report an issue: GitHub.