AlistGo/alist · error

wukong get upload auth token failed: code=%d message=%s

Error message

wukong get upload auth token failed: code=%d message=%s

What it means

Thrown by the Wukong driver's getUploadAuthToken before any upload: GET /toutiao/upload/auth_token/v1/ returned a non-zero business code. This endpoint mints the VOD (bytedanceapi.com) security token required for all subsequent vodRequest-signed calls, so its failure aborts the entire Put flow.

Source

Thrown at drivers/wukong/driver.go:410

func (d *Wukong) getUploadAuthToken(ctx context.Context, uploadType string) (*uploadAuthTokenResp, error) {
	var resp uploadAuthTokenResp
	_, err := d.client.R().
		SetContext(ctx).
		SetQueryParams(map[string]string{
			"upload_source":   uploadSourceByType(uploadType),
			"type":            uploadType,
			"aid":             d.Aid,
			"device_platform": "web",
			"language":        d.Language,
		}).
		SetResult(&resp).
		Get("/toutiao/upload/auth_token/v1/")
	if err != nil {
		return nil, err
	}
	if resp.Code != 0 {
		return nil, fmt.Errorf("wukong get upload auth token failed: code=%d message=%s", resp.Code, resp.Message)
	}
	return &resp, nil
}

func (d *Wukong) getUploadCandidates(ctx context.Context, auth *uploadAuthTokenResp) (*getUploadCandidatesResp, error) {
	q := map[string]string{
		"Action":    "GetUploadCandidates",
		"Version":   "2020-11-19",
		"SpaceName": videoSpaceName,
	}
	var resp getUploadCandidatesResp
	if err := d.vodRequest(ctx, http.MethodGet, q, nil, auth, &resp); err != nil {
		return nil, err
	}
	if resp.ResponseMetadata.Error.Code != "" {
		return nil, fmt.Errorf("wukong get upload candidates failed: %s", resp.ResponseMetadata.Error.Message)
	}
	return &resp, nil

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Re-login to Wukong and save fresh driver storage, then retry the upload
  2. Verify d.Aid and d.Language are set (non-empty, expected values) in driver config before upload
  3. Retry with backoff once in case of transient upstream rate limiting
  4. Check whether the Wukong pan still exposes the Toutiao upload path (API change) and update the driver if not
Defensive patterns

Strategy: retry

Validate before calling

if d.Aid == "" || d.Language == "" {
    return errors.New("wukong driver config incomplete: aid/language missing")
}

Try / catch

auth, err := d.getUploadAuthToken(ctx, uploadType)
if err != nil {
    if isWukongAuthErr(err) { // re-login then one retry
        if lerr := d.relogin(ctx); lerr == nil {
            auth, err = d.getUploadAuthToken(ctx, uploadType)
        }
    }
    if err != nil {
        return fmt.Errorf("upload aborted, token unavailable: %w", err)
    }
}

Prevention

When it happens

Trigger: Expired or invalid Wukong login state (cookies/Safari token) so auth_token is refused; the tied upload service (Toutiao/VOD) not enabled for the account; missing or wrong aid/device_platform query params; upstream rate limiting on token minting.

Common situations: Long-running upload started after the login session timed out; account region/language settings changed breaking the aid param; Wukong (wkbrowser pan) backend API change; too many concurrent uploads each minting tokens.

Related errors


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