AlistGo/alist · error

failed to list blobs for deletion

Error message

failed to list blobs for deletion: %w

What it means

deleteFolder could not enumerate the blobs under the directory prefix before deleting them, so recursive removal aborts; the flat-list error from the SDK is wrapped.

Solutions

  1. Inspect the underlying error details in the message, fix the indicated cause (credentials, network, or provider-side failure), and retry.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at drivers/azure_blob/util.go:139 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15). Data as JSON: /api/errors/313c3234057a36c7. Report an issue: GitHub.

Appendix: source

Thrown at drivers/azure_blob/util.go:139

					blobName = *resp.BlobName
				}
				return fmt.Errorf("failed to delete blob %s: %v", blobName, resp.Error)
			}
		}
	}

	return nil
}

// deleteFolder recursively deletes a directory and all its contents
func (d *AzureBlob) deleteFolder(ctx context.Context, prefix string) error {
	// Ensure directory path ends with slash
	prefix = ensureTrailingSlash(prefix)

	// Get all blobs under the directory using flattenListBlobs
	globs, err := d.flattenListBlobs(ctx, prefix)
	if err != nil {
		return fmt.Errorf("failed to list blobs for deletion: %w", err)
	}

	// If there are blobs in the directory, delete them
	if len(globs) > 0 {
		// 分离文件和目录标记
		var filePaths []string
		var dirPaths []string

		for _, blob := range globs {
			blobName := *blob.Name
			if isDirectory(blob) {
				// remove trailing slash for directory names
				dirPaths = append(dirPaths, strings.TrimSuffix(blobName, "/"))
			} else {
				filePaths = append(filePaths, blobName)
			}
		}

View on GitHub (pinned to 843d9dc814)