AlistGo/alist · error

failed to list directory

Error message

failed to list directory: %w

What it means

While walking the path from the root, listing one of the intermediate directories failed, so the target link cannot be resolved; the bridge listing error is wrapped and the failing depth is wherever the loop currently is.

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/proton_drive/util.go:85 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/31dc926c7488410c. Report an issue: GitHub.

Appendix: source

Thrown at drivers/proton_drive/util.go:85

}

func (d *ProtonDrive) searchByPath(ctx context.Context, fullPath string, isFolder bool) (*proton.Link, error) {
	if fullPath == "/" {
		return d.protonDrive.RootLink, nil
	}

	cleanPath := strings.Trim(fullPath, "/")
	pathParts := strings.Split(cleanPath, "/")

	currentLink := d.protonDrive.RootLink

	for i, part := range pathParts {
		isLastPart := i == len(pathParts)-1
		searchForFolder := !isLastPart || isFolder

		entries, err := d.protonDrive.ListDirectory(ctx, currentLink.LinkID)
		if err != nil {
			return nil, fmt.Errorf("failed to list directory: %w", err)

		}

		found := false
		for _, entry := range entries {
			// entry.Name is already decrypted!
			if entry.Name == part && entry.IsFolder == searchForFolder {
				currentLink = entry.Link
				found = true
				break
			}
		}

		if !found {
			return nil, fmt.Errorf("path not found: %s (looking for part: %s)", fullPath, part)
		}
	}

View on GitHub (pinned to 843d9dc814)