hashicorp/nomad · error

%w: %q

Error message

%w: %q

What it means

This is the formatted wrapper "<err>: <mode>" produced in VolumeMount.Validate when the propagation mode is invalid. It wraps the sentinel errVolMountInvalidPropagationMode with the offending PropagationMode value quoted, aggregated into the multierror returned to the caller.

Source

Thrown at nomad/structs/volumes.go:335

	if v == nil {
		return nil
	}

	nv := new(VolumeMount)
	*nv = *v
	return nv
}

func (v *VolumeMount) Validate() error {
	var mErr *multierror.Error

	// Validate the task does not reference undefined volume mounts
	if v.Volume == "" {
		mErr = multierror.Append(mErr, errVolMountEmptyVol)
	}

	if !v.MountPropagationModeIsValid() {
		mErr = multierror.Append(mErr, fmt.Errorf("%w: %q", errVolMountInvalidPropagationMode, v.PropagationMode))
	}

	if !v.SELinuxLabelIsValid() {
		mErr = multierror.Append(mErr, fmt.Errorf("%w: \"%s\"", errVolMountInvalidSELinuxLabel, v.SELinuxLabel))
	}

	return mErr.ErrorOrNil()
}

func (v *VolumeMount) MountPropagationModeIsValid() bool {
	switch v.PropagationMode {
	case "", VolumeMountPropagationPrivate, VolumeMountPropagationHostToTask, VolumeMountPropagationBidirectional:
		return true
	default:
		return false
	}
}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Change the mount's propagation_mode to "private", "host-to-task", or "bidirectional".
  2. Read the quoted value at the end of the error to identify the exact bad input.
  3. Omit propagation_mode to accept the default.

Example fix

// before
PropagationMode: "rshared"
// after
PropagationMode: "bidirectional"
Defensive patterns

Strategy: validation

Validate before calling

if !mount.MountPropagationModeIsValid() {
    return fmt.Errorf("bad propagation mode: %q", mount.PropagationMode)
}

Type guard

func isValidPropagationMode(m string) bool {
    return m == "private" || m == "host-to-task" || m == "bidirectional"
}

Try / catch

if err := mount.Validate(); err != nil {
    if errors.Is(err, errVolMountInvalidPropagationMode) {
        // fix propagation_mode and retry
    }
}

Prevention

When it happens

Trigger: VolumeMount.Validate is called and MountPropagationModeIsValid() returns false, i.e. PropagationMode is not one of the accepted constants; the resulting error text is "volume mount has an invalid propagation mode: \"<value>\"".

Common situations: Same as the underlying sentinel: misspelled propagation_mode in job specs, Docker-style propagation strings, machine-generated config with invalid defaults.

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


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