{"record":{"id":"6d18c8f6a2959036","repo":"docker/cli","slug":"cannot-mix-tmpfs-options-with-mount-type-s","errorCode":null,"errorMessage":"cannot mix 'tmpfs-*' options with mount type '%s'","messagePattern":"cannot mix 'tmpfs-\\*' options with mount type '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"opts/mount_utils.go","lineNumber":62,"sourceCode":"// the daemon, but with error-messages matching client-side flags / options.\n//\n// [mounts.validateExclusiveOptions]: https://github.com/moby/moby/blob/v2.0.0-beta.6/daemon/volume/mounts/validate.go#L31-L50\nfunc validateExclusiveOptions(m *mount.Mount) error {\n\tif m.Type == \"\" {\n\t\treturn errors.New(\"type is required\")\n\t}\n\n\tif m.Type != mount.TypeBind && m.BindOptions != nil {\n\t\treturn fmt.Errorf(\"cannot mix 'bind-*' options with mount type '%s'\", m.Type)\n\t}\n\tif m.Type != mount.TypeVolume && m.VolumeOptions != nil {\n\t\treturn fmt.Errorf(\"cannot mix 'volume-*' options with mount type '%s'\", m.Type)\n\t}\n\tif m.Type != mount.TypeImage && m.ImageOptions != nil {\n\t\treturn fmt.Errorf(\"cannot mix 'image-*' options with mount type '%s'\", m.Type)\n\t}\n\tif m.Type != mount.TypeTmpfs && m.TmpfsOptions != nil {\n\t\treturn fmt.Errorf(\"cannot mix 'tmpfs-*' options with mount type '%s'\", m.Type)\n\t}\n\tif m.Type != mount.TypeCluster && m.ClusterOptions != nil {\n\t\treturn fmt.Errorf(\"cannot mix 'cluster-*' options with mount type '%s'\", m.Type)\n\t}\n\treturn nil\n}\n\n// parseBoolValue returns the boolean value represented by the string. It returns\n// true if no value is set.\n//\n// It is similar to [strconv.ParseBool], but only accepts 1, true, 0, false.\n// Any other value returns an error.\nfunc parseBoolValue(key string, val string, hasValue bool) (bool, error) {\n\tif !hasValue {\n\t\treturn true, nil\n\t}\n\tswitch val {\n\tcase \"1\", \"true\":","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/opts/mount_utils.go#L44-L80","documentation":"Returned by validateExclusiveOptions (opts/mount_utils.go:62) when a mount's Type is not TypeTmpfs but TmpfsOptions is non-nil. The tmpfs-* options (tmpfs-size, tmpfs-mode) are exclusive to type=tmpfs.","triggerScenarios":"Setting tmpfs-size or tmpfs-mode on a bind/volume/image/cluster mount, e.g. `--mount type=volume,source=v,target=/d,tmpfs-size=64m`, or programmatically setting mount.TmpfsOptions on a non-tmpfs Mount.","commonSituations":"Converting a tmpfs mount to a volume but leaving tmpfs options, or generators that always attach TmpfsOptions.","solutions":["Use type=tmpfs to keep tmpfs-size/tmpfs-mode.","Or remove tmpfs-* options from non-tmpfs mounts."],"exampleFix":"// before\n--mount \"type=volume,source=v,target=/d,tmpfs-size=64m\"\n\n// after\n--mount \"type=tmpfs,destination=/d,tmpfs-size=64m\"","handlingStrategy":"validation","validationCode":"func validateExclusive(m mount.Mount) error {\n    if m.Type != mount.TypeTmpfs && m.TmpfsOptions != nil {\n        return fmt.Errorf(\"tmpfs-* options require type=tmpfs, got %s\", m.Type)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := m.Set(spec); err != nil {\n    return fmt.Errorf(\"mount %q: %w\", spec, err)\n}","preventionTips":["Only attach TmpfsOptions when Type == TypeTmpfs.","When changing a tmpfs mount to volume, drop TmpfsOptions.","Gate tmpfs-* fields behind a type=tmpfs check in your UI."],"tags":["mount","docker","tmpfs","exclusive-options","validation"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}