AlistGo/alist · error

[doubao] API error (code: %d): %s

Error message

[doubao] API error (code: %d): %s

What it means

CommonResp.GetError in the doubao_share driver converts any non-zero business code from a Doubao share API response into an error, preferring the message field, then msg, then the nested error.message. The code and text after the colon come straight from the server and identify the real problem (expired share, invalid token, rate limit, etc.).

Source

Thrown at drivers/doubao_share/types.go:193

	return r.Code == 0
}

// GetError 获取错误信息
func (r *CommonResp) GetError() error {
	if r.IsSuccess() {
		return nil
	}
	// 优先使用message字段
	errMsg := r.Message
	if errMsg == "" {
		errMsg = r.Msg
	}
	// 如果error对象存在且有详细消息,则使用error中的信息
	if r.Error != nil && r.Error.Message != "" {
		errMsg = r.Error.Message
	}

	return fmt.Errorf("[doubao] API error (code: %d): %s", r.Code, errMsg)
}

// UnmarshalData 将data字段解析为指定类型
func (r *CommonResp) UnmarshalData(v interface{}) error {
	if !r.IsSuccess() {
		return r.GetError()
	}

	if len(r.Data) == 0 {
		return nil
	}

	return json.Unmarshal(r.Data, v)
}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Match the code/message: expiry-related messages mean re-open the share in a browser and update share_ids; auth messages mean refresh the driver's cookies/token.
  2. Verify the share_id value and the share's availability (not deleted/password-protected) in a browser.
  3. Retry after backoff if the message indicates rate limiting.
  4. Update the driver binary — share API contract changes are typically fixed in newer releases.
Defensive patterns

Strategy: try-catch

Type guard

func isDoubaoShareAPIError(err error) bool {
    return err != nil && strings.Contains(err.Error(), "[doubao] API error (code:")
}

Try / catch

files, err := d.getShareOverview(shareId, "")
if err != nil {
    if isDoubaoShareAPIError(err) {
        msg := err.Error()
        switch {
        case strings.Contains(msg, "expired") || strings.Contains(msg, "cancel"):
            // share dead: surface config error, stop retrying
        case strings.Contains(msg, "frequency") || strings.Contains(msg, "rate"):
            time.Sleep(5 * time.Second) // then retry once
        default:
            return err
        }
    }
    return err
}

Prevention

When it happens

Trigger: Any doubao_share API call (share overview, file list, get share info) whose envelope has code != 0: share link expired or revoked, wrong share_id format, visitor token not obtained/refreshed, rate limiting, or an authenticated endpoint hit without credentials.

Common situations: The shared link's passcode/availability changed after the mount was configured; long-running mounts whose share access token timed out; typo'd share_id in the share_ids config; Doubao tightening access to the share API.

Related errors


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