AlistGo/alist · error

add offline download task failed

Error message

add offline download task failed: %w

What it means

Wraps the error from pan123 Offline.Download in Open123.OfflineDownload: the 123 open platform rejected the request to create an offline download task (bad URL, quota, or API failure). The task ID was never created.

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/123_open/offline.go:37 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/440ee00c3f871965. Report an issue: GitHub.

Appendix: source

Thrown at drivers/123_open/offline.go:37

// the offline-download tool, which lives outside this package.
func (d *Open123) OfflineDownload(ctx context.Context, url string, parentDir model.Obj, fileName string) (int64, error) {
	if err := d.ensureToken(ctx); err != nil {
		return 0, err
	}
	dirID, err := parseFileID(parentDir.GetID())
	if err != nil {
		return 0, err
	}
	if dirID == 0 {
		return 0, errOfflineRootDir
	}
	taskID, err := d.client.Offline.Download(ctx, &pan123.OfflineDownloadRequest{
		URL:      url,
		FileName: fileName,
		DirID:    dirID,
	})
	if err != nil {
		return 0, fmt.Errorf("add offline download task failed: %w", err)
	}
	return taskID, nil
}

// OfflineProcess reports the progress and state of an offline download task.
func (d *Open123) OfflineProcess(ctx context.Context, taskID int64) (*pan123.OfflineProcessResult, error) {
	if err := d.ensureToken(ctx); err != nil {
		return nil, err
	}
	res, err := d.client.Offline.Process(ctx, taskID)
	if err != nil {
		return nil, fmt.Errorf("query offline download task %d failed: %w", taskID, err)
	}
	return res, nil
}

View on GitHub (pinned to 843d9dc814)