AlistGo/alist · error
instant upload returns empty task id
Error message
instant upload returns empty task id
What it means
GuangYaPan's getUploadToken returned code 156, which signals instant (seeded) upload — the provider recognized the file hash and skips data transfer — but the accompanying TaskID field was empty. The driver cannot poll waitUploadTaskInfo without a task id, so it aborts rather than assume success.
Source
Thrown at drivers/guangyapan/driver.go:401
}
if file.GetSize() < 0 {
return errors.New("invalid file size")
}
name := strings.TrimSpace(file.GetName())
if name == "" {
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)
}
View on GitHub (pinned to 843d9dc814)
Solutions
- Retry the upload once — transient response-shape issues usually resolve
- If reproducible, force a non-instant path by changing the file slightly (or wait for provider fix)
- Check driver updates: the field mapping of getUploadToken's response may need to track API changes
- Report to OpenList maintainers with the raw token response if it persists
Defensive patterns
Strategy: retry
Validate before calling
token, code, err := d.getUploadToken(ctx, parentID, name, size)
if err != nil { return err }
if code == 156 && strings.TrimSpace(token.TaskID) == "" {
// provider glitch: retry once with a fresh token request
token, code, err = d.getUploadToken(ctx, parentID, name, size)
if err != nil { return err }
}
return d.put(ctx, dstDir, file, up) // proceed with validated token Try / catch
if err := d.Put(ctx, dir, file, up); err != nil {
if strings.Contains(err.Error(), "instant upload returns empty task id") {
time.Sleep(time.Second)
return d.Put(ctx, dir, file, up) // one bounded retry
}
return err
} Prevention
- Treat code-156 responses with empty task ids as transient; retry once, not indefinitely
- Keep the driver updated — provider response shapes drift
- Capture debug logs of the token response when it reproduces and report upstream
When it happens
Trigger: Uploading a file whose content already exists provider-side (code 156) while the API response omits Data.TaskID — provider inconsistency, race in their seeding pipeline, or a response-shape change.
Common situations: Re-uploading a previously uploaded file; uploads during provider maintenance; API version drift where the instant-upload payload no longer includes the task id.
Related errors
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/87af90b63f20f8e5.
Report an issue: GitHub.