AlistGo/alist · error

upload URL is empty

Error message

upload URL is empty

What it means

Returned by the Baidu Netdisk driver when the pre-create response contains neither Servers nor BakServers entries, so there is no superfile upload endpoint to PUT chunks to. The allocation succeeded but no upload URL was provided.

Source

Thrown at drivers/baidu_netdisk/util.go:416

		"uploadid":       uploadId,
		"upload_version": "2.0",
	}
	apiUrl := "https://d.pcs.baidu.com/rest/2.0/pcs/file"
	var resp UploadServerResp
	_, err := d.request(apiUrl, http.MethodGet, func(req *resty.Request) {
		req.SetQueryParams(params)
	}, &resp)
	if err != nil {
		return "", err
	}
	var uploadUrl string
	if len(resp.Servers) > 0 {
		uploadUrl = resp.Servers[0].Server
	} else if len(resp.BakServers) > 0 {
		uploadUrl = resp.BakServers[0].Server
	}
	if uploadUrl == "" {
		return "", errors.New("upload URL is empty")
	}
	return uploadUrl, nil
}

// func encodeURIComponent(str string) string {
// 	r := url.QueryEscape(str)
// 	r = strings.ReplaceAll(r, "+", "%20")
// 	return r
// }

func DecryptMd5(encryptMd5 string) string {
	if _, err := hex.DecodeString(encryptMd5); err == nil {
		return encryptMd5
	}

	var out strings.Builder
	out.Grow(len(encryptMd5))
	for i, n := 0, int64(0); i < len(encryptMd5); i++ {

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Enable debug logging and inspect the full precreate response body for an embedded error code
  2. Update alist to the latest version (response-schema changes are fixed driver-side)
  3. Retry after a short cooldown; transient allocation failures do occur
  4. Check the Baidu account status (quota, app authorization) in the netdisk client
Defensive patterns

Strategy: retry

Try / catch

url, err := d.getUploadUrl(...)
if err != nil && strings.Contains(err.Error(), "upload URL is empty") {
    time.Sleep(backoff) // allocation may be transient
    url, err = d.getUploadUrl(...)
}

Prevention

When it happens

Trigger: Calling the precreate/superfile2 upload flow where resp.Servers and resp.BakServers are both empty arrays — typically when the server response shape changed, the response was an unrecognized error, or the region/ISP allocation returned no servers.

Common situations: Baidu changed the pre-create response schema (newer driver needed); account is rate-limited or in an abnormal state so precreate returns partial data; network egress via proxy caused server list omission.

Related errors


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