{"record":{"id":"02b99eea38d40475","repo":"argoproj/argo-workflows","slug":"failed-to-create-destination-s-w","errorCode":null,"errorMessage":"failed to create destination %s: %w","messagePattern":"failed to create destination (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/argoexec/commands/emissary.go","lineNumber":713,"sourceCode":"\t\tlogger.WithField(\"srcPath\", srcPath).Info(ctx, \"no need to save artifact - on overlapping volume\")\n\t\treturn nil\n\t}\n\tif _, err := os.Stat(srcPath); os.IsNotExist(err) { // might be optional, so we ignore\n\t\tlogger.WithField(\"srcPath\", srcPath).WithError(err).Warn(ctx, \"cannot save artifact\")\n\t\treturn nil\n\t}\n\tdstPath := filepath.Join(varRunArgo, \"/outputs/artifacts/\", strings.TrimSuffix(srcPath, \"/\")+\".tgz\")\n\tlogger.WithFields(logging.Fields{\n\t\t\"src\": srcPath,\n\t\t\"dst\": dstPath,\n\t}).Info(ctx, \"saving artifact\")\n\tz := filepath.Dir(dstPath)\n\tif err := os.MkdirAll(z, 0o755); err != nil { // chmod rwxr-xr-x\n\t\treturn fmt.Errorf(\"failed to create directory %s: %w\", z, err)\n\t}\n\tdst, err := os.Create(dstPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create destination %s: %w\", dstPath, err)\n\t}\n\tdefer func() { _ = dst.Close() }()\n\tif err = archive.TarGzToWriter(ctx, srcPath, gzip.DefaultCompression, dst); err != nil {\n\t\treturn fmt.Errorf(\"failed to tarball the output %s to %s: %w\", srcPath, dstPath, err)\n\t}\n\tif err = dst.Close(); err != nil {\n\t\treturn fmt.Errorf(\"failed to close %s: %w\", dstPath, err)\n\t}\n\treturn nil\n}\n\nfunc saveParameter(ctx context.Context, template *wfv1.Template, srcPath string) error {\n\tlogger := logging.RequireLoggerFromContext(ctx)\n\n\tif common.FindOverlappingVolume(template, srcPath) != nil {\n\t\tlogger.WithField(\"src\", srcPath).Info(ctx, \"no need to save parameter - on overlapping volume\")\n\t\treturn nil\n\t}","sourceCodeStart":695,"sourceCodeEnd":731,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/cmd/argoexec/commands/emissary.go#L695-L731","documentation":"saveArtifact failed to create the artifact destination file (<dstPath> under /var/run/argo/outputs/artifacts) via os.Create after its parent directory was made. The step's output artifact cannot be written. The wrapped OS error carries the concrete cause.","triggerScenarios":"os.Create(dstPath) fails: destination path is a directory, too many open files (EMFILE), disk full, or write permission denied on the newly created output directory.","commonSituations":"Artifact path in the template points at a directory instead of a file; hitting the pod's file-descriptor limit while many artifacts/parameters save concurrently; ENOSPC; SELinux/AppArmor denying writes.","solutions":["Check the wrapped error: EISDIR means the template's artifact path must point to a file, not a directory.","Increase pod ulimits (RLIMIT_NOFILE) if EMFILE appears; reduce concurrent output saving.","Free disk space if ENOSPC.","Fix write permissions/UID for /var/run/argo/outputs (volume + securityContext)."],"exampleFix":"// before\noutputs:\n  artifacts:\n  - name: dir-out\n    path: /tmp/results      # directory -> os.Create fails EISDIR\n// after: archive a file path (directories get tarballed from srcPath)\noutputs:\n  artifacts:\n  - name: dir-out\n    path: /tmp/results.tgz","handlingStrategy":"validation","validationCode":"// ensure the artifact destination is a file path, not a directory path\nif fi, err := os.Stat(dstPath); err == nil && fi.IsDir() {\n    return fmt.Errorf(\"artifact destination %s is a directory\", dstPath)\n}\n// check fd headroom\nvar lim syscall.Rlimit\n_ = syscall.Getrlimit(syscall.RLIMIT_NOFILE, &lim)","typeGuard":null,"tryCatchPattern":"err := runStep(ctx)\nif err != nil && strings.Contains(err.Error(), \"failed to create destination\") {\n    if errors.Is(errors.Unwrap(err), syscall.EISDIR) {\n        return fixTemplateArtifactPath(ctx) // path must end in a file\n    }\n    return err\n}","preventionTips":["Point artifact outputs at file paths, not directory paths","Avoid saving dozens of artifacts from one step (fd exhaustion)","Confirm the image securityContext allows writing under /var/run/argo/outputs","Free disk space before workflows producing many large artifacts"],"tags":["argo-workflows","argoexec","artifacts","filesystem"],"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"}