AlistGo/alist · error

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

Error message

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

What it means

CommonResp.GetError() builds the canonical Doubao API error: the response envelope carried a non-success code. It prefers error.message, falls back to top-level message, then msg, and formats code plus message. Every Doubao request path (d.request and UnmarshalData) routes failures through this, so any Doubao API rejection surfaces as this error.

Source

Thrown at drivers/doubao/types.go:401

	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. If the message indicates auth/session expiry, refresh the driver's cookie/credentials in Additional config and re-test
  2. Reduce concurrency/backoff and retry — transient rate-limit codes clear on their own
  3. Search the error message text in Doubao driver issues; cookie-header format changes (missing fields) produce confusing codes
  4. If code is consistently unknown after an app update, the driver may need updating to the new API contract

Example fix

// before
return fmt.Errorf("[doubao] API error (code: %d): %s", r.Code, errMsg)
// after — include ResponseMetadata.RequestId so support/issue reports can correlate
return fmt.Errorf("[doubao] API error (code: %d): %s (request_id: %s)", r.Code, errMsg, r.ResponseMetadata.RequestId)
Defensive patterns

Strategy: try-catch

Validate before calling

if d.Cookie == "" { // driver's session credential
	return errors.New("doubao session cookie not configured")
}

Type guard

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

Try / catch

if isDoubaoAPIError(err) {
	if isSessionError(err) { // message mentions login/expired
		return reloginAndRetry()
	}
	return backoffRetry(3)
}

Prevention

When it happens

Trigger: Doubao/ByteDance backend returns Code != Success in ResponseMetadata — session cookie expired (need re-login), rate limiting, object not found, upload quota exceeded, or invalid parameters on endpoints like /passport/account/info/v2/ or upload config endpoints.

Common situations: Long-lived mounts whose cookie/token expired (most common); heavy concurrent uploads hitting rate limits; account region restrictions; API contract changes after Doubao app updates.

Related errors


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