{"record":{"id":"766a87512155a097","repo":"argoproj/argo-workflows","slug":"unable-to-test-if-s-is-a-directory-w","errorCode":null,"errorMessage":"unable to test if %s is a directory: %w","messagePattern":"unable to test if (.+?) is a directory: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"workflow/artifacts/azure/azure.go","lineNumber":371,"sourceCode":"\t}\n\treturn nil\n}\n\n// Delete deletes an artifact from a Azure Blob Storage\nfunc (azblobDriver *ArtifactDriver) Delete(ctx context.Context, artifact *wfv1.Artifact) 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).\n\t\tInfo(ctx, \"Deleting object from Azure Blob Storage\")\n\tcontainerClient, err := azblobDriver.newAzureContainerClient(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to create Azure Blob Container client: %w\", err)\n\t}\n\n\tisDir, err := azblobDriver.IsDirectory(ctx, artifact)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to test if %s is a directory: %w\", artifact.Azure.Blob, err)\n\t}\n\n\tif !isDir {\n\t\treturn DeleteBlob(ctx, containerClient, artifact.Azure.Blob, true)\n\t}\n\tfiles, err := azblobDriver.ListObjects(ctx, artifact)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to list files in %s: %w\", artifact.Azure.Blob, err)\n\t}\n\tdirectoryFile := \"\"\n\tfor _, file := range files {\n\t\tif file == artifact.Azure.Blob {\n\t\t\tdirectoryFile = file\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := DeleteBlob(ctx, containerClient, file, true); err != nil {\n\t\t\treturn err","sourceCodeStart":353,"sourceCodeEnd":389,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/workflow/artifacts/azure/azure.go#L353-L389","documentation":"Delete first calls IsDirectory to decide whether the artifact is a single blob or a directory prefix. If the IsDirectory probe fails (client creation, network error, or Azure list error), Delete wraps it as 'unable to test if %s is a directory'. The wrapped error is usually 430/437 underneath.","triggerScenarios":"Calling Delete on an artifact when the storage account/container is unreachable (DNS, firewall, private endpoint), credentials are rejected (401/403), or the container client cannot be built — any failure inside the pager.NextPage list call in IsDirectory.","commonSituations":"Storage account behind a firewall that blocks the cluster egress; deleted or renamed storage account; expired SAS token; transient network blips during artifact deletion; container name mismatch between config and actual storage account.","solutions":["Inspect the wrapped cause (%w) to distinguish auth (401/403) vs network vs config errors.","Verify cluster egress can reach <account>.blob.core.windows.net:443 (no firewall/proxy interference).","Confirm the container exists and the credentials can list blobs: az storage blob list --container-name ...","If transient, re-run the workflow deletion; the SDK has default retries but hard failures (auth) will not self-heal.","Fix the underlying client creation problem first (see 'unable to create Azure Blob Container client' guidance)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// probe reachability before the API call\n_, err := driver.ListObjects(ctx, artifact)\nif err != nil {\n    return fmt.Errorf(\"azure storage unreachable for artifact %s: %w\", artifact.Azure.Blob, err)\n}","typeGuard":null,"tryCatchPattern":"err := driver.Delete(ctx, artifact)\nif err != nil && strings.Contains(err.Error(), \"unable to test if\") {\n    if retryable(err) { // network/5xx, not 401/403\n        time.Sleep(backoff)\n        err = driver.Delete(ctx, artifact)\n    }\n}","preventionTips":["Verify cluster egress to the storage endpoint from the executor network.","Rotate SAS tokens before expiry and monitor for 403s.","Pre-check artifact existence with ListObjects in your workflow tooling."],"tags":["azure","blob-storage","network","list-objects"],"backgroundTag":"azure-blob-list-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"}