AlistGo/alist · error

upload task failed: code=%d msg=%s

Error message

upload task failed: code=%d msg=%s

What it means

waitUploadTaskInfo polls the upload task and throws when the response Code is not in the accepted in-progress set (145/146/147/155/163/0) and a non-empty Msg accompanies it. That means the provider reported a definitive failure for the upload task rather than a progress state.

Source

Thrown at drivers/guangyapan/driver.go:952

		maxTry   = 300
		interval = 1 * time.Second
	)
	for i := 0; i < maxTry; i++ {
		var out taskInfoResp
		if err := d.postAPI(ctx, "/nd.bizuserres.s/v1/file/get_info_by_task_id", map[string]any{
			"taskId": taskID,
		}, &out); err != nil {
			return err
		}
		if out.Data.FileID != "" {
			return nil
		}
		switch out.Code {
		case 145, 146, 147, 155, 163, 0:
			// uploading/verifying/processing
		default:
			if strings.TrimSpace(out.Msg) != "" {
				return fmt.Errorf("upload task failed: code=%d msg=%s", out.Code, strings.TrimSpace(out.Msg))
			}
		}
		if i == maxTry-1 {
			break
		}
		select {
		case <-ctx.Done():
			return ctx.Err()
		case <-time.After(interval):
		}
	}
	return fmt.Errorf("upload task %s timeout", taskID)
}

func (d *GuangYaPan) multipartUploadToOSS(ctx context.Context, bucket *oss.Bucket, objectPath string, file model.FileStreamer, up driver.UpdateProgress) error {
	partSize := calcUploadPartSize(file.GetSize())
	imur, err := bucket.InitiateMultipartUpload(objectPath, oss.Sequential())
	if err != nil {

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Retry the upload from scratch - transient ingest failures usually succeed on retry.
  2. If it repeats for the same file, suspect corruption at the source or a provider incident.
  3. Check the embedded code+msg against provider documentation for the specific failure class.
Defensive patterns

Strategy: retry

Try / catch

if err := d.waitUploadTaskInfo(ctx, taskID); err != nil {
    if strings.Contains(err.Error(), "upload task failed: code=") {
        // definitive ingest failure: retry the whole upload once
        return d.Put(ctx, dstDir, file, overwrite)
    }
    return err
}

Prevention

When it happens

Trigger: After bytes are pushed to OSS, the server-side ingest/verify fails and the next get_task_status poll returns an error code + message (e.g. data integrity failure, task cancelled server-side).

Common situations: Multipart upload completed but parts were missing/corrupt; provider-side transcoding/verification failed; task invalidated by a concurrent delete of the target path.

Related errors


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