AlistGo/alist · error

wukong init multipart upload returns empty uploadid

Error message

wukong init multipart upload returns empty uploadid

What it means

Thrown when the TOS (ByteDance object storage) init-multipart-upload endpoint returns the success code (minUploadSubmitSuccess) but an empty Data.UploadID. The uploadID is required by every subsequent UploadPart and CompleteMultipartUpload call; without it the multipart session cannot proceed, so the driver aborts rather than sending parts against a nonexistent session.

Source

Thrown at drivers/wukong/driver.go:661

		SetHeader("Authorization", auth).
		SetQueryParams(map[string]string{
			"uploadmode": "part",
			"phase":      "init",
		}).
		SetResult(&resp)
	if storageUser != "" {
		req.SetHeader("X-Storage-U", storageUser)
	}
	uploadURL := fmt.Sprintf("https://%s/upload/v1/%s", host, storeURI)
	_, err := req.Post(uploadURL)
	if err != nil {
		return "", err
	}
	if resp.Code != minUploadSubmitSuccess {
		return "", fmt.Errorf("wukong init multipart upload failed: code=%d message=%s", resp.Code, resp.Message)
	}
	if resp.Data.UploadID == "" {
		return "", errors.New("wukong init multipart upload returns empty uploadid")
	}
	return resp.Data.UploadID, nil
}

func (d *Wukong) uploadMultipartPart(ctx context.Context, host, storeURI, auth, storageUser, uploadID string, partNumber int, data []byte, crc32Hex string) (string, error) {
	var resp tosUploadResp
	req := base.NewRestyClient().R().
		SetContext(ctx).
		SetHeader("Host", host).
		SetHeader("Referer", webReferer).
		SetHeader("Origin", "https://pan.wkbrowser.com").
		SetHeader("Authorization", auth).
		SetHeader("Content-Type", "application/octet-stream").
		SetHeader("Content-Crc32", crc32Hex).
		SetHeader("Content-Length", strconv.Itoa(len(data))).
		SetQueryParams(map[string]string{
			"uploadid":    uploadID,
			"part_number": strconv.Itoa(partNumber),

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Restart the upload from scratch (new apply + new StoreURI/Auth) — stale store credentials are the most common cause
  2. Retry after a delay if the backend is having a transient issue
  3. Update the wukong driver in case the TOS response schema changed
Defensive patterns

Strategy: retry

Try / catch

if err != nil && strings.Contains(err.Error(), "empty uploadid") {
    // store credentials may be stale: restart apply + init, not just init
    return d.Put(ctx, dstDir, file, up)
}

Prevention

When it happens

Trigger: POST https://{host}/upload/v1/{storeURI} answers code==success yet UploadID is "" — backend session-provisioning glitch, an expired/rejected StoreURI/Auth from an older apply response, or a schema change moving the upload id to a different field.

Common situations: Long pause between applyUploadInner and the actual upload so the store credentials went stale; TOS regional hiccups; driver version drift with the storage API.

Related errors


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