{"record":{"id":"10ab6d2d6f1a5120","repo":"argoproj/argo-workflows","slug":"unable-to-create-file-s-w","errorCode":null,"errorMessage":"unable to create file %s: %w","messagePattern":"unable to create file (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"workflow/artifacts/azure/azure.go","lineNumber":181,"sourceCode":"\terr = azblobDriver.DownloadDirectory(ctx, containerClient, artifact, path)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to download directory %s: %w\", artifact.Azure.Blob, err)\n\t}\n\n\treturn nil\n}\n\n// DownloadFile downloads a single file from Azure Blob Storage\nfunc DownloadFile(ctx context.Context, containerClient *container.Client, blobName, path string) error {\n\tblobClient := containerClient.NewBlobClient(blobName)\n\n\terr := os.MkdirAll(filepath.Dir(path), 0755)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to create dir for file %s: %w\", path, err)\n\t}\n\toutFile, err := os.Create(path)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to create file %s: %w\", path, err)\n\t}\n\tdefer func() {\n\t\tif closeErr := outFile.Close(); closeErr != nil {\n\t\t\tlogger := logging.RequireLoggerFromContext(ctx)\n\t\t\tlogger.WithFatal().WithError(closeErr).Warn(ctx, \"unable to close file\")\n\t\t}\n\t}()\n\n\t_, err = blobClient.DownloadFile(ctx, outFile, nil)\n\treturn err\n}\n\n// DownloadDirectory downloads all of the files starting with the named blob prefix into a local directory.\nfunc (azblobDriver *ArtifactDriver) DownloadDirectory(ctx context.Context, containerClient *container.Client, artifact *wfv1.Artifact, path string) error {\n\tlogger := logging.RequireLoggerFromContext(ctx)\n\tlogger.WithField(\"endpoint\", artifact.Azure.Endpoint).\n\t\tWithField(\"container\", artifact.Azure.Container).\n\t\tWithField(\"blob\", artifact.Azure.Blob).","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/workflow/artifacts/azure/azure.go#L163-L199","documentation":"DownloadFile creates (or truncates) the local destination file with os.Create before streaming the blob into it. This error means os.Create failed, so nothing was downloaded. Typical causes are local filesystem problems at the exact destination path, not Azure-side issues.","triggerScenarios":"os.Create(path) fails with EACCES (no write permission), EISDIR (path is an existing directory), ENOSPC (disk full), ENAMETOOLONG, or the volume is read-only.","commonSituations":"Artifact destination path collides with an existing directory, container disk quota/full ephemeral storage, executor running as non-root against root-owned mount, overly long path from deep blob-name prefixes in directory artifacts.","solutions":["Check the wrapped syscall: EACCES => fix permissions/securityContext; EISDIR => choose a file path; ENOSPC => free disk or expand the volume.","Ensure the artifact path points to a file location writable by argoexec, not a directory.","Free up disk on the node/emptyDir if ENOSPC.","Shorten blob names/prefixes for directory artifacts if ENAMETOOLONG.","Verify the mount backing the path is rw (kubectl describe pod mounts)."],"exampleFix":"// before: path is a directory\npath: /mnt/out\n// after\npath: /mnt/out/data.txt","handlingStrategy":"validation","validationCode":"if fi, err := os.Stat(path); err == nil && fi.IsDir() {\n\treturn fmt.Errorf(\"%s is a directory, expected a file path\", path)\n}\nif err := unix.Access(filepath.Dir(path), unix.W_OK); err != nil {\n\treturn fmt.Errorf(\"no write access to %s\", filepath.Dir(path))\n}","typeGuard":"func canCreateFile(p string) error {\n\tif fi, err := os.Stat(p); err == nil && fi.IsDir() {\n\t\treturn fmt.Errorf(\"%s is a directory\", p)\n\t}\n\tf, err := os.OpenFile(p, os.O_CREATE|os.O_WRONLY, 0o644)\n\tif err != nil { return err }\n\treturn f.Close()\n}","tryCatchPattern":null,"preventionTips":["Ensure artifact path targets a file, not an existing directory","Size emptyDir volumes for expected artifact sizes to avoid ENOSPC","Match executor securityContext to volume ownership (fsGroup)","Keep blob-derived paths short to avoid ENAMETOOLONG"],"tags":["filesystem","local-disk","permissions"],"backgroundTag":"file-create-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"}