{"record":{"id":"5a26884624caa0de","repo":"hashicorp/nomad","slug":"w-q-5a2688","errorCode":null,"errorMessage":"%w: %q","messagePattern":"%w: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/volumes.go","lineNumber":335,"sourceCode":"\tif v == nil {\n\t\treturn nil\n\t}\n\n\tnv := new(VolumeMount)\n\t*nv = *v\n\treturn nv\n}\n\nfunc (v *VolumeMount) Validate() error {\n\tvar mErr *multierror.Error\n\n\t// Validate the task does not reference undefined volume mounts\n\tif v.Volume == \"\" {\n\t\tmErr = multierror.Append(mErr, errVolMountEmptyVol)\n\t}\n\n\tif !v.MountPropagationModeIsValid() {\n\t\tmErr = multierror.Append(mErr, fmt.Errorf(\"%w: %q\", errVolMountInvalidPropagationMode, v.PropagationMode))\n\t}\n\n\tif !v.SELinuxLabelIsValid() {\n\t\tmErr = multierror.Append(mErr, fmt.Errorf(\"%w: \\\"%s\\\"\", errVolMountInvalidSELinuxLabel, v.SELinuxLabel))\n\t}\n\n\treturn mErr.ErrorOrNil()\n}\n\nfunc (v *VolumeMount) MountPropagationModeIsValid() bool {\n\tswitch v.PropagationMode {\n\tcase \"\", VolumeMountPropagationPrivate, VolumeMountPropagationHostToTask, VolumeMountPropagationBidirectional:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}\n","sourceCodeStart":317,"sourceCodeEnd":353,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/volumes.go#L317-L353","documentation":"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.","triggerScenarios":"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>\\\"\".","commonSituations":"Same as the underlying sentinel: misspelled propagation_mode in job specs, Docker-style propagation strings, machine-generated config with invalid defaults.","solutions":["Change the mount's propagation_mode to \"private\", \"host-to-task\", or \"bidirectional\".","Read the quoted value at the end of the error to identify the exact bad input.","Omit propagation_mode to accept the default."],"exampleFix":"// before\nPropagationMode: \"rshared\"\n// after\nPropagationMode: \"bidirectional\"","handlingStrategy":"validation","validationCode":"if !mount.MountPropagationModeIsValid() {\n    return fmt.Errorf(\"bad propagation mode: %q\", mount.PropagationMode)\n}","typeGuard":"func isValidPropagationMode(m string) bool {\n    return m == \"private\" || m == \"host-to-task\" || m == \"bidirectional\"\n}","tryCatchPattern":"if err := mount.Validate(); err != nil {\n    if errors.Is(err, errVolMountInvalidPropagationMode) {\n        // fix propagation_mode and retry\n    }\n}","preventionTips":["Validate mounts before job submission.","Parse the quoted suffix of wrapped errors to find the bad value."],"tags":["nomad","volumes","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}