AlistGo/alist · error

get link of %s failed: %w

Error message

get link of %s failed: %w

What it means

Error "get link of %s failed: %w" thrown in AlistGo/alist.

Source

Thrown at drivers/123_open/read.go:72

	if file.IsDir() {
		return nil, errs.LinkIsDir
	}
	if err := d.ensureToken(ctx); err != nil {
		return nil, err
	}
	fileID, err := parseFileID(file.GetID())
	if err != nil {
		return nil, err
	}

	var rawURL string
	if d.UseDirectLink {
		rawURL, err = d.client.Link.URL(ctx, fileID)
	} else {
		rawURL, err = d.client.File.DownloadInfo(ctx, fileID)
	}
	if err != nil {
		return nil, fmt.Errorf("get link of %s failed: %w", file.GetName(), err)
	}
	if rawURL == "" {
		return nil, errors.New("the server returned an empty download url")
	}

	if d.PrivateKey != "" {
		if d.UID == 0 {
			return nil, errors.New("uid is required when private_key is set")
		}
		validDuration := time.Duration(d.ValidDuration) * time.Minute
		if validDuration <= 0 {
			validDuration = 30 * time.Minute
		}
		rawURL, err = SignURL(rawURL, d.PrivateKey, d.UID, validDuration)
		if err != nil {
			return nil, fmt.Errorf("sign direct link failed: %w", err)
		}
	}

View on GitHub (pinned to 843d9dc814)

Solutions

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

When it happens

Trigger: Thrown at drivers/123_open/read.go:72 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/dcece6e5e16b0c9d. Report an issue: GitHub.