hashicorp/nomad · error

invalid mount type, must be "bind", "volume", "tmpfs": %q

Error message

invalid mount type, must be "bind", "volume", "tmpfs": %q

What it means

Each Nomad mount block must declare type as one of "bind", "volume", or "tmpfs". toDockerMountConfig's switch on m.Type has no matching case for other values, so the driver rejects the mount with this error rather than sending an undefined mount type to Docker.

Source

Thrown at drivers/docker/config.go:638

			DriverConfig: &mount.Driver{
				Name:    vo.DriverConfig.Name,
				Options: vo.DriverConfig.Options,
			},
		}
	case "bind":
		hm.BindOptions = &mount.BindOptions{
			Propagation: mount.Propagation(m.BindOptions.Propagation),
		}
	case "tmpfs":
		if m.Source != "" {
			return hm, fmt.Errorf(`invalid source, must be "" for tmpfs`)
		}
		hm.TmpfsOptions = &mount.TmpfsOptions{
			SizeBytes: m.TmpfsOptions.SizeBytes,
			Mode:      fs.FileMode(m.TmpfsOptions.Mode),
		}
	default:
		return hm, fmt.Errorf(`invalid mount type, must be "bind", "volume", "tmpfs": %q`, m.Type)
	}

	return hm, nil
}

type DockerVolumeOptions struct {
	NoCopy       bool                     `codec:"no_copy"`
	Labels       hclutils.MapStrStr       `codec:"labels"`
	DriverConfig DockerVolumeDriverConfig `codec:"driver_config"`
}

type DockerBindOptions struct {
	Propagation string `codec:"propagation"`
}

type DockerTmpfsOptions struct {
	SizeBytes int64 `codec:"size"`
	Mode      int   `codec:"mode"`

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Set type to exactly "bind", "volume", or "tmpfs" (lowercase).
  2. Re-check spelling/whitespace in the mount stanza.
  3. Consult the Nomad docker driver mount docs for the supported set.

Example fix

// before
mount {
  type   = "Tmpfs"
  target = "/cache"
}
// after
mount {
  type   = "tmpfs"
  target = "/cache"
}
Defensive patterns

Strategy: validation

Validate before calling

var allowed = map[string]bool{"bind": true, "volume": true, "tmpfs": true}
if !allowed[m.Type] {
  return fmt.Errorf("unsupported mount type %q", m.Type)
}

Type guard

func isMountType(s string) bool {
  switch s { case "bind", "volume", "tmpfs": return true }
  return false
}

Prevention

When it happens

Trigger: A mount block sets type to a misspelled or unsupported value such as "Tmpfs", "TMPFS", "tmpfs " (trailing space), "nfs", or another value outside the three allowed ones.

Common situations: Typos or wrong casing in HCL job files; copying Docker Compose volume types (like 'npipe') into Nomad; assuming more mount types exist than this driver supports.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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