{"record":{"id":"55a5a0cce1024fce","repo":"argoproj/argo-workflows","slug":"failed-to-get-directory-w","errorCode":null,"errorMessage":"failed to get directory: %w","messagePattern":"failed to get directory: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"workflow/artifacts/s3/s3.go","lineNumber":227,"sourceCode":"\torigErr := s3cli.GetFile(inputArtifact.S3.Bucket, inputArtifact.S3.Key, path)\n\tif origErr == nil {\n\t\treturn true, nil\n\t}\n\tif !IsS3ErrCode(origErr, \"NoSuchKey\") {\n\t\treturn !isTransientS3Err(ctx, origErr), fmt.Errorf(\"failed to get file: %w\", origErr)\n\t}\n\t// If we get here, the error was a NoSuchKey. The key might be an s3 \"directory\"\n\tisDir, err := s3cli.IsDirectory(inputArtifact.S3.Bucket, inputArtifact.S3.Key)\n\tif err != nil {\n\t\treturn !isTransientS3Err(ctx, err), fmt.Errorf(\"failed to test if %s is a directory: %w\", inputArtifact.S3.Key, err)\n\t}\n\tif !isDir {\n\t\t// It's neither a file, nor a directory. Return the original NoSuchKey error\n\t\treturn true, argoerrs.New(argoerrs.CodeNotFound, origErr.Error())\n\t}\n\n\tif err = s3cli.GetDirectory(inputArtifact.S3.Bucket, inputArtifact.S3.Key, path); err != nil {\n\t\treturn !isTransientS3Err(ctx, err), fmt.Errorf(\"failed to get directory: %w\", err)\n\t}\n\treturn true, nil\n}\n\n// OpenStream opens a stream reader for an artifact from S3 compliant storage\nfunc (s3Driver *ArtifactDriver) OpenStream(ctx context.Context, inputArtifact *wfv1.Artifact) (io.ReadCloser, error) {\n\tlog := logging.RequireLoggerFromContext(ctx)\n\tlog.WithField(\"key\", inputArtifact.S3.Key).Info(ctx, \"S3 OpenStream\")\n\t//nolint:contextcheck\n\ts3cli, err := s3Driver.newClient(log.NewBackgroundContext())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create new S3 client: %w\", err)\n\t}\n\n\treturn streamS3Artifact(ctx, s3cli, inputArtifact)\n}\n\nfunc streamS3Artifact(_ context.Context, s3cli Client, inputArtifact *wfv1.Artifact) (io.ReadCloser, error) {","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/workflow/artifacts/s3/s3.go#L209-L245","documentation":"After NoSuchKey and a successful IsDirectory=true probe, the driver downloads the key as a directory (all objects under the prefix). This error wraps a failure of GetDirectory — the directory download itself failed after the key was confirmed to be a prefix.","triggerScenarios":"loadS3Artifact: s3cli.GetDirectory(bucket, key, path) returned an error while listing/downloading all objects under the prefix — partial download failure, network interruption, permission denied on individual objects, or disk write failure at `path`.","commonSituations":"Large directory artifacts interrupted mid-transfer; IAM allows ListBucket but denies GetObject on some objects; local volume full in the workflow pod; S3-compatible storage returning malformed listing responses.","solutions":["Retry the workflow — the driver marks transient errors retryable via isTransientS3Err/backoff","Check pod disk space and volume mounts where the artifact is extracted","Verify s3:GetObject permission on all objects under the key prefix","Check bucket endpoint/region configuration and S3 provider health; test listing the prefix manually with aws s3 cp"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"aws s3 cp --recursive s3://my-bucket/my/key/ /tmp/test >/dev/null && echo OK","typeGuard":null,"tryCatchPattern":"if err := s3Driver.Load(ctx, path, art); err != nil {\n    if errors.Is(err, context.DeadlineExceeded) || isTransientS3Err(ctx, err) {\n        // safe to retry\n    }\n}","preventionTips":["Keep directory artifacts small; tar them into a single object when possible","Monitor pod disk space for extraction targets","Grant GetObject on the whole prefix, not individual objects","Pin endpoint/region config and verify with periodic health checks"],"tags":["s3","artifacts","aws","network"],"backgroundTag":"s3-download-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"}