{"record":{"id":"ac739f5abca64301","repo":"hashicorp/nomad","slug":"invalid-source-must-be-for-tmpfs","errorCode":null,"errorMessage":"invalid source, must be \"\" for tmpfs","messagePattern":"invalid source, must be \"\" for tmpfs","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/docker/config.go","lineNumber":631,"sourceCode":"\n\tswitch m.Type {\n\tcase \"volume\":\n\t\tvo := m.VolumeOptions\n\t\thm.VolumeOptions = &mount.VolumeOptions{\n\t\t\tNoCopy: vo.NoCopy,\n\t\t\tLabels: vo.Labels,\n\t\t\tDriverConfig: &mount.Driver{\n\t\t\t\tName:    vo.DriverConfig.Name,\n\t\t\t\tOptions: vo.DriverConfig.Options,\n\t\t\t},\n\t\t}\n\tcase \"bind\":\n\t\thm.BindOptions = &mount.BindOptions{\n\t\t\tPropagation: mount.Propagation(m.BindOptions.Propagation),\n\t\t}\n\tcase \"tmpfs\":\n\t\tif m.Source != \"\" {\n\t\t\treturn hm, fmt.Errorf(`invalid source, must be \"\" for tmpfs`)\n\t\t}\n\t\thm.TmpfsOptions = &mount.TmpfsOptions{\n\t\t\tSizeBytes: m.TmpfsOptions.SizeBytes,\n\t\t\tMode:      fs.FileMode(m.TmpfsOptions.Mode),\n\t\t}\n\tdefault:\n\t\treturn hm, fmt.Errorf(`invalid mount type, must be \"bind\", \"volume\", \"tmpfs\": %q`, m.Type)\n\t}\n\n\treturn hm, nil\n}\n\ntype DockerVolumeOptions struct {\n\tNoCopy       bool                     `codec:\"no_copy\"`\n\tLabels       hclutils.MapStrStr       `codec:\"labels\"`\n\tDriverConfig DockerVolumeDriverConfig `codec:\"driver_config\"`\n}\n","sourceCodeStart":613,"sourceCodeEnd":649,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/drivers/docker/config.go#L613-L649","documentation":"When converting a Nomad mount block to a Docker mount, a mount of type \"tmpfs\" must have an empty source: tmpfs mounts are backed by in-memory storage, not a host path or named volume. The driver returns this error if a non-empty source is supplied for a tmpfs mount.","triggerScenarios":"A job's mount block sets type = \"tmpfs\" but also sets source = \"/path\" (or any volume name).","commonSituations":"Users copy a bind-mount block and change only type to tmpfs, forgetting that tmpfs needs no source; or they intend a volume/bind mount and mistype the type.","solutions":["Remove the source field from the tmpfs mount block.","If you need a host path or named volume, change type to \"bind\" or \"volume\" instead of tmpfs.","Verify the mount stanza only uses destination/target plus tmpfs_options for tmpfs mounts."],"exampleFix":"// before\nmount {\n  type   = \"tmpfs\"\n  source = \"/data\"\n  target = \"/cache\"\n}\n// after\nmount {\n  type   = \"tmpfs\"\n  target = \"/cache\"\n  tmpfs_options {\n    size = 64000000\n  }\n}","handlingStrategy":"validation","validationCode":"for _, m := range mounts {\n  if m.Type == \"tmpfs\" && m.Source != \"\" {\n    return fmt.Errorf(\"mount %q: tmpfs must not set source\", m.Target)\n  }\n}","typeGuard":"func validTmpfsMount(m Mount) bool { return m.Type != \"tmpfs\" || m.Source == \"\" }","tryCatchPattern":null,"preventionTips":["Never set source on tmpfs mounts.","Change type to bind/volume if a source is required.","Review mount blocks after editing type."],"tags":["docker","mount","tmpfs","validation"],"backgroundTag":"invalid-config-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"}