{"record":{"id":"54211b0137bdc4d7","repo":"argoproj/argo-workflows","slug":"volumemounts-d-mountpath-s-already-mounted-in","errorCode":null,"errorMessage":"volumeMounts[%d].mountPath '%s' already mounted in %s","messagePattern":"volumeMounts\\[(.+?)\\]\\.mountPath '(.+?)' already mounted in (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apis/workflow/v1alpha1/container_set_template_types.go","lineNumber":108,"sourceCode":"func (in *ContainerSetTemplate) Validate() error {\n\tif len(in.Containers) == 0 {\n\t\treturn fmt.Errorf(\"containers must have at least one container\")\n\t}\n\n\tnames := make([]string, 0)\n\tfor _, ctr := range in.Containers {\n\t\tnames = append(names, ctr.Name)\n\t}\n\terr := validateWorkflowFieldNames(names, false)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"containers%s\", err.Error())\n\t}\n\n\t// Ensure there are no collisions with volume mountPaths and artifact load paths\n\tmountPaths := make(map[string]string)\n\tfor i, volMount := range in.VolumeMounts {\n\t\tif prev, ok := mountPaths[volMount.MountPath]; ok {\n\t\t\treturn fmt.Errorf(\"volumeMounts[%d].mountPath '%s' already mounted in %s\", i, volMount.MountPath, prev)\n\t\t}\n\t\tmountPaths[volMount.MountPath] = fmt.Sprintf(\"volumeMounts.%s\", volMount.Name)\n\t}\n\n\t// Ensure the dependencies are defined\n\tnameToContainer := make(map[string]ContainerNode)\n\tfor _, ctr := range in.Containers {\n\t\tnameToContainer[ctr.Name] = ctr\n\t}\n\tfor _, ctr := range in.Containers {\n\t\tfor _, depName := range ctr.Dependencies {\n\t\t\t_, ok := nameToContainer[depName]\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"containers.%s dependency '%s' not defined\", ctr.Name, depName)\n\t\t\t}\n\t\t}\n\t}\n","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/pkg/apis/workflow/v1alpha1/container_set_template_types.go#L90-L126","documentation":"Within a ContainerSetTemplate all containers share the pod's filesystem, so two volumeMounts may not claim the same mountPath. Validate() tracks every mountPath in a map and fails when a later mount collides with an earlier one, reporting which index/path was already mounted and where.","triggerScenarios":"Two containerSet.volumeMounts entries (or two containers mounting the same volume at the same subPath/mountPath) specify the identical mountPath string in the same container set.","commonSituations":"Copying a volumeMount block and forgetting to change mountPath; mounting the same shared volume at the same path in two containers (in a containerSet the mounts are validated set-wide, unlike a normal pod); generated manifests merging mounts from multiple sources.","solutions":["Change one volumeMount's mountPath to a distinct directory (e.g. /data vs /data2), or use different subPath values.","Remove the redundant volumeMount if both entries reference the same volume/path.","Review the error's \"already mounted in\" suffix to find the original volumeMount.name and reconcile the two."],"exampleFix":"// before\ncontainerSet:\n  volumeMounts:\n    - name: workdir\n      mountPath: /data\n    - name: cache\n      mountPath: /data\n// after\ncontainerSet:\n  volumeMounts:\n    - name: workdir\n      mountPath: /data\n    - name: cache\n      mountPath: /cache","handlingStrategy":"validation","validationCode":"seen := map[string]string{}\nfor i, vm := range cs.ContainerSet.VolumeMounts {\n    if prev, ok := seen[vm.MountPath]; ok {\n        return fmt.Errorf(\"mountPath %q duplicated (%s vs %s)\", vm.MountPath, prev, vm.Name)\n    }\n    seen[vm.MountPath] = vm.Name\n}","typeGuard":null,"tryCatchPattern":"if err := cs.Validate(); err != nil {\n    if strings.Contains(err.Error(), \"already mounted in\") {\n        // parse the conflicting index/path from the message and dedupe mounts\n    }\n    return err\n}","preventionTips":["Maintain a central list of mountPaths per container set and dedupe at render time.","Use subPath to separate logical mounts under shared volumes.","Validate rendered manifests with argo lint before submit."],"tags":["go","validation","container-set","volume-mounts"],"backgroundTag":"mount-path-collision","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}