AlistGo/alist · error

failed to download source file

Error message

failed to download source file: %w

What it means

Downloading the source file's content (including decryption) failed at the start of a copy, so nothing can be re-uploaded; the bridge download error 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/proton_drive/driver.go:321 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/f77c1f1c29199c92. Report an issue: GitHub.

Appendix: source

Thrown at drivers/proton_drive/driver.go:321

		return nil, fmt.Errorf("protonDrive bridge is nil")
	}

	return d.DirectRename(ctx, srcObj, newName)
}

func (d *ProtonDrive) Copy(ctx context.Context, srcObj, dstDir model.Obj) (model.Obj, error) {
	if srcObj.IsDir() {
		return nil, fmt.Errorf("directory copy not supported")
	}

	srcLink, err := d.searchByPath(ctx, srcObj.GetPath(), false)
	if err != nil {
		return nil, err
	}

	reader, linkSize, fileSystemAttrs, err := d.protonDrive.DownloadFile(ctx, srcLink, 0)
	if err != nil {
		return nil, fmt.Errorf("failed to download source file: %w", err)
	}
	defer reader.Close()

	actualSize := linkSize
	if fileSystemAttrs != nil && fileSystemAttrs.Size > 0 {
		actualSize = fileSystemAttrs.Size
	}

	tempFile, err := utils.CreateTempFile(reader, actualSize)
	if err != nil {
		return nil, fmt.Errorf("failed to create temp file: %w", err)
	}
	defer tempFile.Close()

	updatedObj := &model.Object{
		Name: srcObj.GetName(),
		// Use the accurate and real size
		Size:     actualSize,

View on GitHub (pinned to 843d9dc814)