{"record":{"id":"77d7c46edf1b0af0","repo":"argoproj/argo-workflows","slug":"failed-to-tarball-the-output-s-to-s-w","errorCode":null,"errorMessage":"failed to tarball the output %s to %s: %w","messagePattern":"failed to tarball the output (.+?) to (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/argoexec/commands/emissary.go","lineNumber":717,"sourceCode":"\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}\n\tsrc, err := os.Open(filepath.Clean(srcPath))\n\tif os.IsNotExist(err) { // might be optional, so we ignore\n\t\tlogger.WithField(\"src\", srcPath).WithError(err).Warn(ctx, \"cannot save parameter, does not exist\")\n\t\treturn nil","sourceCodeStart":699,"sourceCodeEnd":735,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/cmd/argoexec/commands/emissary.go#L699-L735","documentation":"saveArtifact opened the destination file but archive.TarGzToWriter failed while tarballing the source path (srcPath) into it. This covers read errors on the source (missing file, permission denied, symlink issues) and gzip/tar write errors (disk full). The output artifact is not produced.","triggerScenarios":"archive.TarGzToWriter(ctx, srcPath, gzip.DefaultCompression, dst) returns error: srcPath does not exist or is unreadable by the executor UID, srcPath is a dangling symlink, the source changed/shrank mid-read, or writes to dst fail with ENOSPC.","commonSituations":"Output artifact path doesn't exist in the container (task produced nothing but artifact not marked optional); wrong artifact path spelling; permission on the file written by a different user in the same pod; disk fills during a large artifact upload.","solutions":["Read the wrapped error: 'no such file' means fix the template artifact path or mark the artifact optional:true.","Ensure the step actually writes the file at the declared artifact path before the step exits.","Match file ownership: run the container so the file is readable by the argoexec user, or chmod in the step.","Free disk space if the error is a write/ENOSPC failure during compression."],"exampleFix":"// before: artifact path never written by the script\nscript:\n  source: echo hi          # no file at /tmp/out.txt\noutputs:\n  artifacts:\n  - name: result\n    path: /tmp/out.txt\n// after: either write the file or mark optional\noutputs:\n  artifacts:\n  - name: result\n    path: /tmp/out.txt\n    optional: true","handlingStrategy":"validation","validationCode":"// inside the step, before exit — verify declared outputs exist\nfor _, art := range template.Outputs.Artifacts {\n    if _, err := os.Stat(art.Path); err != nil {\n        if !art.Optional {\n            return fmt.Errorf(\"artifact %s missing at %s\", art.Name, art.Path)\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"err := runStep(ctx)\nif err != nil && strings.Contains(err.Error(), \"failed to tarball the output\") {\n    if errors.Is(errors.Unwrap(err), os.ErrNotExist) {\n        // mark artifact optional or fix the path, then retry\n        return fixArtifactOrMarkOptional(ctx)\n    }\n    return err\n}","preventionTips":["Guarantee the step writes every declared non-optional artifact path","Mark artifacts optional:true when output may legitimately be absent","chmod outputs readable by the executor UID when using multi-container pods","Set sensible artifact sizes; monitor disk during large artifact export"],"tags":["argo-workflows","argoexec","artifacts","tar","gzip"],"backgroundTag":"artifact-tarball-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"}