hashicorp/nomad · error
invalid artifact mode %q; must be one of: %s, %s, %s
Error message
invalid artifact mode %q; must be one of: %s, %s, %s
What it means
TaskArtifact.Validate: the artifact mode is not one of any/file/dir (or empty, which defaults to any). Mode controls whether go-getter expects a single file, a directory, or either.
Source
Thrown at nomad/structs/structs.go:9929
_, _ = 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"))
}
if err := ta.validateChecksum(); err != nil {
mErr.Errors = append(mErr.Errors, err)
}
return mErr.ErrorOrNil()
}
func (ta *TaskArtifact) validateChecksum() error {View on GitHub (pinned to 482b49bf1a)
Solutions
- Set mode to "any", "file", or "dir" as appropriate for the source
- Omit mode; it defaults to "any"
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at nomad/structs/structs.go:9929 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/a1f2929800c2d830.
Report an issue: GitHub.