{"record":{"id":"997ec739023a09a1","repo":"argoproj/argo-workflows","slug":"mkdir-s-error-w","errorCode":null,"errorMessage":"mkdir %s error: %w","messagePattern":"mkdir (.+?) error: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"workflow/artifacts/oss/oss.go","lineNumber":149,"sourceCode":"\t\t\tlogging.RequireLoggerFromContext(ctx).WithFields(logging.Fields{\"path\": path, \"key\": inputArtifact.OSS.Key}).Info(ctx, \"OSS Load\")\n\t\t\tosscli, err := ossDriver.newOSSClient(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn !isTransientOSSErr(ctx, err), err\n\t\t\t}\n\t\t\tbucketName := inputArtifact.OSS.Bucket\n\t\t\terr = setBucketLogging(osscli, bucketName)\n\t\t\tif err != nil {\n\t\t\t\treturn !isTransientOSSErr(ctx, err), err\n\t\t\t}\n\t\t\tbucket, err := osscli.Bucket(bucketName)\n\t\t\tif err != nil {\n\t\t\t\treturn !isTransientOSSErr(ctx, err), err\n\t\t\t}\n\t\t\tobjectName := inputArtifact.OSS.Key\n\t\t\tdirPath := filepath.Dir(path)\n\t\t\terr = os.MkdirAll(dirPath, 0o700)\n\t\t\tif err != nil {\n\t\t\t\treturn false, fmt.Errorf(\"mkdir %s error: %w\", dirPath, err)\n\t\t\t}\n\t\t\torigErr := bucket.GetObjectToFile(objectName, path)\n\t\t\tif origErr == nil {\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t\tif !IsOssErrCode(origErr, \"NoSuchKey\") {\n\t\t\t\treturn !isTransientOSSErr(ctx, origErr), fmt.Errorf(\"failed to get file: %w\", origErr)\n\t\t\t}\n\t\t\t// If we get here, the error was a NoSuchKey. The key might be a oss \"directory\"\n\t\t\tisDir, err := IsOssDirectory(bucket, objectName)\n\t\t\tif err != nil {\n\t\t\t\treturn !isTransientOSSErr(ctx, err), fmt.Errorf(\"failed to test if %s/%s is a directory: %w\", bucketName, objectName, err)\n\t\t\t}\n\t\t\tif !isDir {\n\t\t\t\t// It's neither a file, nor a directory. Return the original NoSuchKey error\n\t\t\t\treturn false, origErr\n\t\t\t}\n","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/workflow/artifacts/oss/oss.go#L131-L167","documentation":"During OSS Load, after fetching the object fails, the driver ensures the destination directory exists via os.MkdirAll(filepath.Dir(path), 0o700) before a possible directory download. If creating that local directory fails (permissions, read-only FS, path is a file), Load retries then surfaces 'mkdir <dir> error'.","triggerScenarios":"Downloading an OSS artifact to a local path whose parent directory cannot be created: the output mount is read-only, the pod user lacks write permission on the parent (e.g. writing to / or /etc), the parent path exists as a regular file, or disk is full.","commonSituations":"Empty-volume mount paths in containers where the artifact path resolves to a system directory; running the executor as non-root while the artifact path defaults to a root-owned location; a volumeMount with readOnly: true on the destination path.","solutions":["Point the input artifact `path` at a writable location, e.g. /tmp/... or a writable emptyDir/PVC mount.","Remove readOnly: true from the volumeMount backing the artifact path, or mount a second writable volume.","Ensure the container's runAsUser/runAsGroup has write permission on the destination parent.","Check that the destination parent is not an existing file (delete or rename the conflicting path)."],"exampleFix":"// before\ninputs:\n  artifacts:\n    - name: data\n      path: /mnt/data/read-only/input.json  # readonly mount\n// after\ninputs:\n  artifacts:\n    - name: data\n      path: /work/input.json   # writable volume","handlingStrategy":"validation","validationCode":"func validateWritableDest(path string) error {\n\tdir := filepath.Dir(path)\n\tif fi, err := os.Stat(dir); err == nil && !fi.IsDir() {\n\t\treturn fmt.Errorf(\"%s exists and is not a directory\", dir)\n\t}\n\tprobe := filepath.Join(dir, \".argo-write-probe\")\n\tif err := os.WriteFile(probe, nil, 0o600); err != nil {\n\t\treturn fmt.Errorf(\"destination %s not writable: %w\", dir, err)\n\t}\n\t_ = os.Remove(probe)\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":"err := driver.Load(ctx, art, path)\nif err != nil && strings.Contains(err.Error(), \"mkdir \") {\n\t// destination parent unwritable: remount writable volume or change path\n}","preventionTips":["Mount a writable volume for artifact paths; avoid readOnly mounts on destinations","Use /tmp or an emptyDir for input artifact downloads","Ensure runAsUser has write access to the artifact directory","Check disk space and that the parent path isn't an existing file"],"tags":["oss","artifact","filesystem","permissions","mkdir"],"backgroundTag":"local-directory-creation-failed","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"}