hashicorp/nomad · error
volume has unrecognized type %s
Error message
volume has unrecognized type %s
What it means
VolumeRequest.Validate returns this error when the volume's Type is neither "host" nor "csi". Nomad only recognizes these two volume types for volume requests, so any other value makes the whole request invalid immediately.
Source
Thrown at nomad/structs/volumes.go:150
return false
case v.Sticky != o.Sticky:
return false
case v.AccessMode != o.AccessMode:
return false
case v.AttachmentMode != o.AttachmentMode:
return false
case !v.MountOptions.Equal(o.MountOptions):
return false
case v.PerAlloc != o.PerAlloc:
return false
}
return true
}
func (v *VolumeRequest) Validate(jobType string, taskGroupCount, canaries int) error {
if !(v.Type == VolumeTypeHost ||
v.Type == VolumeTypeCSI) {
return fmt.Errorf("volume has unrecognized type %s", v.Type)
}
var mErr multierror.Error
addErr := func(msg string, args ...any) {
mErr.Errors = append(mErr.Errors, fmt.Errorf(msg, args...))
}
if v.Source == "" {
addErr("volume has an empty source")
}
if v.PerAlloc {
if jobType == JobTypeSystem || jobType == JobTypeSysBatch {
addErr("volume cannot be per_alloc for system or sysbatch jobs")
}
if canaries > 0 {
addErr("volume cannot be per_alloc when canaries are in use")
}
if v.Sticky {View on GitHub (pinned to 482b49bf1a)
Solutions
- Set the volume's type to "host" or "csi".
- Check the error message suffix for the exact unrecognized type string and fix the spelling.
- For dynamic/host volume workflows verify the correct type keyword against your Nomad version's docs.
Example fix
// before
volume "db" { type = "persistent" }
// after
volume "db" { type = "csi" } Defensive patterns
Strategy: validation
Validate before calling
if v.Type != "host" && v.Type != "csi" {
return fmt.Errorf("volume type must be host or csi, got %q", v.Type)
} Type guard
func isValidVolumeType(t string) bool {
return t == "host" || t == "csi"
} Prevention
- Use only "host" or "csi" as volume types.
- Run `nomad job validate` on job files before submission.
- Check your Nomad version's docs for the supported volume type keywords.
When it happens
Trigger: Calling Validate(jobType, taskGroupCount, canaries) on a VolumeRequest whose Type is not VolumeTypeHost ("host") or VolumeTypeCSI ("csi") — e.g. type = "local" or a typo like "hosts" in a job spec's volume block.
Common situations: Typo in the volume type field of a job file; using types from other orchestrators (e.g. Kubernetes 'persistentVolumeClaim'); older configs predating CSI volume support that used now-removed type names.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- volume mount has an invalid propagation mode
- wait config is nil or empty
- missing datacenter for client registration
- default_identity_ttl must be greater than 0
- max_identity_ttl must be greater than 0
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/feea553c86b43f30.
Report an issue: GitHub.