AlistGo/alist · error
upload token is incomplete
Error message
upload token is incomplete
What it means
For a normal (non-instant) upload, GuangYaPan exchanges an upload token that must contain OSS credentials: ObjectPath, BucketName, EndPoint, AccessKeyID, SecretAccessKey (SessionToken is optional). If any mandatory field is empty the driver cannot construct the aliyun-OSS client and refuses with this aggregate error.
Source
Thrown at drivers/guangyapan/driver.go:407
return errors.New("file name is empty")
}
parentID := dstDir.GetID()
token, code, err := d.getUploadToken(ctx, parentID, name, file.GetSize())
if err != nil {
return err
}
taskID := strings.TrimSpace(token.TaskID)
if code == 156 {
if taskID == "" {
return errors.New("instant upload returns empty task id")
}
return d.waitUploadTaskInfo(ctx, taskID)
}
if token.ObjectPath == "" || token.BucketName == "" || token.EndPoint == "" || token.AccessKeyID == "" || token.SecretAccessKey == "" {
return errors.New("upload token is incomplete")
}
ossEndpoint := normalizeOSSEndpoint(token.EndPoint, token.BucketName)
client, err := oss.New(ossEndpoint, token.AccessKeyID, token.SecretAccessKey, oss.SecurityToken(token.SessionToken))
if err != nil {
return fmt.Errorf("create oss client failed: %w", err)
}
bucket, err := client.Bucket(token.BucketName)
if err != nil {
return fmt.Errorf("create oss bucket failed: %w", err)
}
if file.GetSize() == 0 {
if err := bucket.PutObject(token.ObjectPath, strings.NewReader("")); err != nil {
return err
}
} else {
if err := d.multipartUploadToOSS(ctx, bucket, token.ObjectPath, file, up); err != nil {View on GitHub (pinned to 843d9dc814)
Solutions
- Verify the account can upload via the provider's official app
- Update the OpenList/Alist driver to the latest version (field-mapping fixes land there)
- Retry after re-login (refresh tokens) in case the grant was partial
- If it persists, capture the token response (debug logs) and report the changed schema
Defensive patterns
Strategy: try-catch
Validate before calling
missing := []string{}
if token.ObjectPath == "" { missing = append(missing, "object_path") }
if token.BucketName == "" { missing = append(missing, "bucket_name") }
if token.EndPoint == "" { missing = append(missing, "endpoint") }
if token.AccessKeyID == "" { missing = append(missing, "access_key_id") }
if token.SecretAccessKey == "" { missing = append(missing, "secret_access_key") }
if len(missing) > 0 {
return fmt.Errorf("upload token missing fields: %s", strings.Join(missing, ", "))
} Type guard
func uploadTokenComplete(t UploadToken) bool {
return t.ObjectPath != "" && t.BucketName != "" && t.EndPoint != "" && t.AccessKeyID != "" && t.SecretAccessKey != ""
} Try / catch
if err := d.Put(ctx, dir, file, up); err != nil {
if strings.Contains(err.Error(), "upload token is incomplete") {
// re-auth then retry once; stale/partial grants sometimes resolve
if rerr := d.refreshToken(ctx); rerr == nil {
return d.Put(ctx, dir, file, up)
}
return errors.New("provider did not issue full OSS credentials; verify account upload rights and update the driver")
}
return err
} Prevention
- Confirm the account can upload through the provider's official client before debugging OpenList
- Update OpenList/Alist regularly so token-response field mappings track provider API changes
- Re-login (fresh tokens) when uploads suddenly start failing after working
- Log (at debug level) the token response keys when this fires to spot renamed fields
When it happens
Trigger: getUploadToken succeeds but returns a partially populated struct — provider changed field names/casing, returned a different response envelope, or the account lacks OSS upload authorization so the credentials block is omitted.
Common situations: Provider API drift after an update; new/unverified accounts without storage quota; token requested for a path the account cannot write to.
Related errors
- instant upload returns empty task id
- create oss client failed: %w
- create oss bucket failed: %w
- login failed: provide a valid access_token, or refresh_token
- empty download url
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/1dc0e861e38bdc14.
Report an issue: GitHub.