AlistGo/alist · error

file_token is required

Error message

file_token is required

What it means

Input validation in DownloadExportFile: the fileToken argument was empty or whitespace after trimming, so no export download can be requested. Fires when callers pass an unpopulated export result (job not finished, FileToken nil).

Solutions

  1. Provide a valid token in the storage configuration and save it again.
  2. If the token expired, re-login or refresh it through the provider and update the configuration.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at drivers/lark/other.go:232 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/292e48f31f9a4cc1. Report an issue: GitHub.

Appendix: source

Thrown at drivers/lark/other.go:232

	if result.FileSize != nil {
		out.FileSize = *result.FileSize
	}
	if result.JobStatus != nil {
		out.JobStatus = *result.JobStatus
	}
	if out.Status == larkExportStatusFailed {
		out.ErrorMessage = larkExportTaskErrorMessage(result)
		out.ErrorDetail = larkExportTaskErrorDetail(result)
	} else if result.JobErrorMsg != nil {
		out.ErrorMessage = strings.TrimSpace(*result.JobErrorMsg)
	}
	return out, nil
}

func (c *Lark) DownloadExportFile(ctx context.Context, fileToken string) (io.Reader, string, error) {
	fileToken = strings.TrimSpace(fileToken)
	if fileToken == "" {
		return nil, "", errors.New("file_token is required")
	}
	resp, err := doDrive(ctx, c, func(opts ...larkcore.RequestOptionFunc) (*larkdrive.DownloadExportTaskResp, error) {
		return c.client.Drive.V1.ExportTask.Download(ctx,
			larkdrive.NewDownloadExportTaskReqBuilder().FileToken(fileToken).Build(), opts...)
	})
	if err != nil {
		return nil, "", err
	}
	if !resp.Success() {
		return nil, "", larkAPIError(resp)
	}
	if resp.File == nil {
		return nil, "", errors.New("lark export download response missing file")
	}
	return resp.File, resp.FileName, nil
}

func larkExportType(name string) (string, error) {

View on GitHub (pinned to 843d9dc814)