{"record":{"id":"335e54356fe05a2e","repo":"docker/cli","slug":"cluster-options-are-incompatible-with-type-tmpfs","errorCode":null,"errorMessage":"cluster options are incompatible with type tmpfs","messagePattern":"cluster options are incompatible with type tmpfs","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/compose/convert/volume.go","lineNumber":162,"sourceCode":"}\n\nfunc handleTmpfsToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, error) {\n\tresult := createMountFromVolume(volume)\n\n\tif volume.Source != \"\" {\n\t\treturn mount.Mount{}, errors.New(\"invalid tmpfs source, source must be empty\")\n\t}\n\tif volume.Bind != nil {\n\t\treturn mount.Mount{}, errors.New(\"bind options are incompatible with type tmpfs\")\n\t}\n\tif volume.Volume != nil {\n\t\treturn mount.Mount{}, errors.New(\"volume options are incompatible with type tmpfs\")\n\t}\n\tif volume.Image != nil {\n\t\treturn mount.Mount{}, errors.New(\"image options are incompatible with type tmpfs\")\n\t}\n\tif volume.Cluster != nil {\n\t\treturn mount.Mount{}, errors.New(\"cluster options are incompatible with type tmpfs\")\n\t}\n\tif volume.Tmpfs != nil {\n\t\tresult.TmpfsOptions = &mount.TmpfsOptions{\n\t\t\tSizeBytes: volume.Tmpfs.Size,\n\t\t}\n\t}\n\treturn result, nil\n}\n\nfunc handleNpipeToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, error) {\n\tresult := createMountFromVolume(volume)\n\n\tif volume.Source == \"\" {\n\t\treturn mount.Mount{}, errors.New(\"invalid npipe source, source cannot be empty\")\n\t}\n\tif volume.Volume != nil {\n\t\treturn mount.Mount{}, errors.New(\"volume options are incompatible with type npipe\")\n\t}","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/compose/convert/volume.go#L144-L180","documentation":"Returned by handleTmpfsToMount (cli/compose/convert/volume.go:161-162). Cluster options describe Swarm cluster volumes and are meaningless for a local in-memory tmpfs; the converter rejects the combination. ClusterOpts is empty, so `cluster:` or `cluster: {}` both trip it.","triggerScenarios":"ServiceVolumeConfig with Type==\"tmpfs\" and Cluster!=nil passed to convertVolumeToMount().","commonSituations":"Migrating a cluster volume entry to tmpfs without stripping the `cluster:` key; YAML anchors injecting the field.","solutions":["Remove the `cluster:` key from the tmpfs entry.","If a Swarm cluster volume was intended, change `type:` to `cluster`, drop `tmpfs:`/`bind:`/`volume:`/`image:` blocks, and set a non-empty source."],"exampleFix":"# before\nvolumes:\n  - type: tmpfs\n    target: /cache\n    cluster: {}\n\n# after\nvolumes:\n  - type: tmpfs\n    target: /cache","handlingStrategy":"validation","validationCode":"for i, v := range serviceVolumes {\n    if v.Type == \"tmpfs\" && v.Cluster != nil {\n        return fmt.Errorf(\"service volume[%d] target=%q: type tmpfs must not declare a cluster block\", i, v.Target)\n    }\n}","typeGuard":null,"tryCatchPattern":"mounts, err := convert.Volumes(serviceVolumes, stackVolumes, namespace)\nif err != nil && strings.Contains(err.Error(), \"cluster options are incompatible with type tmpfs\") {\n    return fmt.Errorf(\"compose config error: %w (remove the cluster: block from the tmpfs entry)\", err)\n}","preventionTips":["tmpfs is local and in-memory; cluster options are Swarm-only and never combine.","Beware empty `cluster: {}` — the pointer is non-nil and still trips the guard."],"tags":["docker","compose","volumes","tmpfs","cluster-volume","config-validation"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}