{"record":{"id":"e76769cdc9afc154","repo":"hashicorp/nomad","slug":"volume-mount-has-an-invalid-propagation-mode","errorCode":null,"errorMessage":"volume mount has an invalid propagation mode","messagePattern":"volume mount has an invalid propagation mode","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/volumes.go","lineNumber":24,"sourceCode":"import (\n\t\"fmt\"\n\n\tmultierror \"github.com/hashicorp/go-multierror\"\n)\n\nconst (\n\tVolumeTypeHost = \"host\"\n\n\tVolumeMountPropagationPrivate       = \"private\"\n\tVolumeMountPropagationHostToTask    = \"host-to-task\"\n\tVolumeMountPropagationBidirectional = \"bidirectional\"\n\n\tSELinuxSharedVolume  = \"z\"\n\tSELinuxPrivateVolume = \"Z\"\n)\n\nvar (\n\terrVolMountInvalidPropagationMode = fmt.Errorf(\"volume mount has an invalid propagation mode\")\n\terrVolMountInvalidSELinuxLabel    = fmt.Errorf(\"volume mount has an invalid SELinux label\")\n\terrVolMountEmptyVol               = fmt.Errorf(\"volume mount references an empty volume\")\n)\n\n// ClientHostVolumeConfig is used to configure access to host paths on a Nomad Client\ntype ClientHostVolumeConfig struct {\n\tName     string `hcl:\",key\"`\n\tPath     string `hcl:\"path\"`\n\tReadOnly bool   `hcl:\"read_only\"`\n\t// ID is set for dynamic host volumes only.\n\tID string `hcl:\"-\"`\n}\n\nfunc (p *ClientHostVolumeConfig) Equal(o *ClientHostVolumeConfig) bool {\n\tif p == nil && o == nil {\n\t\treturn true\n\t}\n\tif p == nil || o == nil {","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/volumes.go#L6-L42","documentation":"This error is returned by VolumeMount.Validate in nomad/structs/volumes.go when a task's volume mount specifies a propagation mode that Nomad does not recognize. The declared sentinel error errVolMountInvalidPropagationMode is wrapped with the offending value via fmt.Errorf(\"%w: %q\"). Propagation modes must be one of the valid VolumeMount PropagationMode values (e.g. private, host-to-task, bidirectional).","triggerScenarios":"Calling Validate() on a VolumeMount whose PropagationMode field is not one of the allowed constants, e.g. the test value \"very invalid propagation mode\". Typically caused by a typo in an HCL/JSON job spec's mount propagation_mode.","commonSituations":"Hand-edited Nomad job files with misspelled propagation_mode; jobs generated by tooling that emits Docker-style propagation strings (e.g. 'rprivate', 'rslave') instead of Nomad's modes; copy-pasted config between container runtimes.","solutions":["Set the mount's propagation_mode to a valid value: \"private\", \"host-to-task\", or \"bidirectional\".","Check the exact value in the error message suffix (the %q portion) for typos or stray whitespace.","Remove the propagation_mode field entirely to use the default (private)."],"exampleFix":"// before\nmounts = [{ volume = \"data\", propagation_mode = \"rprivate\" }]\n// after\nmounts = [{ volume = \"data\", propagation_mode = \"private\" }]","handlingStrategy":"validation","validationCode":"validModes := map[string]bool{\"private\": true, \"host-to-task\": true, \"bidirectional\": true}\nif !validModes[mount.PropagationMode] {\n    return fmt.Errorf(\"invalid propagation_mode %q\", mount.PropagationMode)\n}","typeGuard":"func isValidPropagationMode(m string) bool {\n    return m == \"private\" || m == \"host-to-task\" || m == \"bidirectional\"\n}","tryCatchPattern":null,"preventionTips":["Only use the documented propagation modes: private, host-to-task, bidirectional.","Run `nomad job validate` before submitting jobs.","Do not copy propagation strings from Docker configs."],"tags":["nomad","volumes","validation","config"],"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"}