AlistGo/alist · error

lark download requires web proxy

Error message

lark download requires web proxy

What it means

Terminal branch of Lark.Link(): Feishu download URLs require the Authorization header, which browsers/clients cannot attach to a raw URL, so direct linking is impossible. Unless WebProxy is true (the branch above that proxies via alist with the Bearer header), the driver refuses with this error rather than returning a link that would 401.

Source

Thrown at drivers/lark/driver.go:418

			if err != nil {
				return nil, err
			}
			_ = ar.Body.Close()
		}

		if ar.StatusCode != http.StatusPartialContent {
			return nil, errors.New("failed to get download link")
		}

		return &model.Link{
			URL: url,
			Header: http.Header{
				"Authorization": []string{fmt.Sprintf("Bearer %s", accessToken)},
			},
		}, nil
	}

	return nil, errors.New("lark download requires web proxy")
}

func (c *Lark) filePreviewURL(token string) string {
	prefix := strings.TrimRight(strings.TrimSpace(c.TenantUrlPrefix), "/")
	if prefix == "" {
		prefix = "https://www.feishu.cn"
	}
	return prefix + "/file/" + token
}

func (c *Lark) downloadAccessToken(ctx context.Context, forceRefresh bool) (string, error) {
	var accessToken string
	var err error
	if strings.TrimSpace(c.RefreshToken) != "" || strings.TrimSpace(c.UserAccessToken) != "" {
		accessToken, err = c.ensureUserAccessToken(ctx, forceRefresh)
		if err != nil {
			return "", err
		}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Enable the WebProxy option in the Lark storage settings and retry the download
  2. If proxying is undesired, use the preview URL (filePreviewURL) for doc-like files instead of download
  3. For native docs, use the export task flow to obtain a downloadable file
Defensive patterns

Strategy: validation

Validate before calling

if !c.WebProxy {
	return nil, errors.New("lark downloads require the web proxy option; enable it in storage settings")
}

Prevention

When it happens

Trigger: Link() called on any file while c.WebProxy == false. The direct-URL path is skipped entirely; there is no fallback.

Common situations: Freshly added Lark storage where 'web proxy'/'webdav proxy' option was left off; user expects 302-style redirects like other drivers provide.

Related errors


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