hashicorp/nomad · error

source must be specified

Error message

source must be specified

What it means

TaskArtifact.Validate: the artifact's source getter string is empty. Every artifact block needs a source URL/path for the go-getter to fetch.

Source

Thrown at nomad/structs/structs.go:9919

	}

	_, _ = h.Write([]byte(ta.GetterSource))

	hashStringMap(h, ta.GetterOptions)
	hashStringMap(h, ta.GetterHeaders)

	_, _ = h.Write([]byte(ta.GetterMode))
	_, _ = h.Write([]byte(strconv.FormatBool(ta.GetterInsecure)))
	_, _ = h.Write([]byte(ta.RelativeDest))
	_, _ = h.Write([]byte(strconv.FormatBool(ta.Chown)))
	return base64.RawStdEncoding.EncodeToString(h.Sum(nil))
}

func (ta *TaskArtifact) Validate() error {
	// Verify the source
	var mErr multierror.Error
	if ta.GetterSource == "" {
		mErr.Errors = append(mErr.Errors, fmt.Errorf("source must be specified"))
	}

	switch ta.GetterMode {
	case "":
		// Default to any
		ta.GetterMode = GetterModeAny
	case GetterModeAny, GetterModeFile, GetterModeDir:
		// Ok
	default:
		mErr.Errors = append(mErr.Errors, fmt.Errorf("invalid artifact mode %q; must be one of: %s, %s, %s",
			ta.GetterMode, GetterModeAny, GetterModeFile, GetterModeDir))
	}

	escaped, err := escapingfs.PathEscapesAllocViaRelative("task", ta.RelativeDest)
	if err != nil {
		mErr.Errors = append(mErr.Errors, fmt.Errorf("invalid destination path: %v", err))
	} else if escaped {
		mErr.Errors = append(mErr.Errors, fmt.Errorf("destination escapes allocation directory"))

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Provide a source URL (file, http, git, s3, etc.) in the artifact block
  2. Remove the artifact block if no artifact is needed
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at nomad/structs/structs.go:9919 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/52488dfa1b3dab27. Report an issue: GitHub.