AlistGo/alist · error
get upload token failed: %s
Error message
get upload token failed: %s
What it means
getUploadToken calls /nd.bizuserres.s/v1/get_res_center_token with the file name, parent, and size; it throws when the envelope Msg is present but not 'success'. (Empty-task-id and credential-fallback cases are separate errors.) The provider is rejecting the upload authorization itself.
Source
Thrown at drivers/guangyapan/driver.go:897
return fmt.Errorf("task %s timeout", taskID)
}
func (d *GuangYaPan) getUploadToken(ctx context.Context, parentID, name string, size int64) (*uploadTokenData, int, error) {
var out uploadTokenResp
err := d.postAPI(ctx, "/nd.bizuserres.s/v1/get_res_center_token", map[string]any{
"capacity": 2,
"name": name,
"parentId": parentID,
"res": map[string]any{
"fileSize": size,
},
}, &out)
if err != nil {
return nil, 0, err
}
msg := strings.TrimSpace(out.Msg)
if msg != "" && !strings.EqualFold(msg, "success") {
return nil, out.Code, fmt.Errorf("get upload token failed: %s", msg)
}
if out.Data.TaskID == "" {
return nil, out.Code, errors.New("get upload token failed: empty task id")
}
if out.Data.AccessKeyID == "" {
out.Data.AccessKeyID = out.Data.Creds.AccessKeyID
}
if out.Data.SecretAccessKey == "" {
out.Data.SecretAccessKey = out.Data.Creds.SecretAccessKey
}
if out.Data.SessionToken == "" {
out.Data.SessionToken = out.Data.Creds.SessionToken
}
if strings.TrimSpace(out.Data.EndPoint) == "" {
out.Data.EndPoint = strings.TrimSpace(out.Data.FullEndPoint)
}
if strings.TrimSpace(out.Data.EndPoint) != "" && !strings.HasPrefix(out.Data.EndPoint, "http://") && !strings.HasPrefix(out.Data.EndPoint, "https://") {
if strings.TrimSpace(out.Data.FullEndPoint) != "" {View on GitHub (pinned to 843d9dc814)
Solutions
- Read the embedded Msg - quota/limit messages point at plan limits; trim the upload or upgrade.
- Verify the destination folder still exists before retrying.
- Retry once for transient server messages.
Defensive patterns
Strategy: validation
Validate before calling
// pre-checks before requesting an upload token
if size > maxPlanSize { // set from your plan's per-file limit
return fmt.Errorf("file %d bytes exceeds plan limit", size)
}
if strings.TrimSpace(name) == "" || strings.ContainsAny(name, "\\/:*?\"<>|") {
return errors.New("file name empty or contains illegal characters")
} Try / catch
if _, _, err := d.getUploadToken(ctx, parentID, name, size); err != nil {
if strings.Contains(err.Error(), "get upload token failed") {
// authorization rejected: surface quota/limit msg to user, do not retry blindly
return fmt.Errorf("upload rejected by provider: %w", err)
}
return err
} Prevention
- Check account quota and per-file size limits before large uploads.
- Confirm the destination folder exists at upload time, not at task-planning time.
When it happens
Trigger: Requesting an upload token for a file that exceeds account quota or per-file limits, an invalid parentId/name, a non-premium account hitting capacity=2 restrictions, or provider-side errors.
Common situations: Uploading a file larger than the plan allows; parent folder deleted mid-upload; free-tier limits on res-center uploads; API contract change adding a required field.
Related errors
- 123 offline download cannot target the root directory, pick
- file is nil
- invalid file size
- file name is empty
- instant upload returns empty task id
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/9060eb7597941c6e.
Report an issue: GitHub.