AlistGo/alist · error

create offline task failed: %s

Error message

create offline task failed: %s

What it means

OfflineDownload's final step POSTs the resolved task URL, parentId, and newName to /cloudcollection/v1/create_task; this error means the HTTP call succeeded but the envelope Msg was not 'success'. (A separate empty-task-id error covers a success response with no TaskID.) The provider refused to queue the offline download.

Source

Thrown at drivers/guangyapan/offline.go:73

	if name == "" {
		name = resolved.defaultName(taskURL)
	}

	body := map[string]any{
		"url":      taskURL,
		"parentId": parentID,
		"newName":  name,
	}
	if indexes := resolved.fileIndexes(); len(indexes) > 0 {
		body["fileIndexes"] = indexes
	}

	var resp offlineCreateResp
	if err := d.postAPI(ctx, "/cloudcollection/v1/create_task", body, &resp); err != nil {
		return nil, err
	}
	if !isSuccessMsg(resp.Msg) {
		return nil, fmt.Errorf("create offline task failed: %s", strings.TrimSpace(resp.Msg))
	}
	taskID := strings.TrimSpace(resp.Data.TaskID)
	if taskID == "" {
		return nil, errors.New("create offline task failed: empty task id")
	}
	return &OfflineTask{
		TaskID:   taskID,
		FileName: name,
		Res:      taskURL,
	}, nil
}

func (d *GuangYaPan) OfflineList(ctx context.Context, taskIDs []string, statuses []int, cursor string, pageSize int) ([]OfflineTask, error) {
	if err := d.ensureAccessToken(ctx); err != nil {
		return nil, err
	}
	body := map[string]any{}
	if len(taskIDs) > 0 {

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Read the embedded Msg - quota/duplicate messages are self-explanatory; clear finished tasks and retry.
  2. Confirm the target folder exists and is writable.
  3. Delete an existing duplicate task for the same URL before re-adding.
Defensive patterns

Strategy: try-catch

Validate before calling

// before creating a task, confirm the target folder is valid
if parentDir == nil || parentDir.GetID() == "" && parentDir.GetPath() != "/" {
    return errors.New("invalid target folder for offline download")
}

Try / catch

if _, err := d.OfflineDownload(ctx, fileURL, parentDir, fileName); err != nil {
    if strings.Contains(err.Error(), "create offline task failed") {
        msg := err.Error()
        if strings.Contains(msg, "exist") || strings.Contains(msg, "duplicate") {
            // duplicate/existing task: harmless, treat as queued
            return nil
        }
        if strings.Contains(msg, "quota") || strings.Contains(msg, "limit") {
            return errors.New("offline task quota exceeded - clean up finished tasks")
        }
    }
    return err
}

Prevention

When it happens

Trigger: create_task rejected because the target folder is invalid/deleted, the offline task quota is full, duplicate task for the same URL, or content the provider blocks; a separate empty-task-id error covers success-with-no-ID.

Common situations: Too many pending offline tasks; offline-download feature restricted on the account plan; parentDir resolved to a folder that no longer exists; the same link already queued.

Related errors


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