AlistGo/alist · error

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

Error message

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

What it means

Doubao_new business error surfaced by the generic response decoder: the body parsed fine as JSON but BaseResp.Code != 0, meaning the Doubao web API rejected the call. The message prefers Msg then Message fields from the response. This is the canonical 'the server said no' error for every doubao_new operation.

Source

Thrown at drivers/doubao_new/util.go:74

	}

	body := res.Body()
	var common BaseResp
	if err = json.Unmarshal(body, &common); err != nil {
		msg := fmt.Sprintf("[doubao_new] decode response failed (status: %s, content-type: %s, body: %s): %v",
			res.Status(),
			res.Header().Get("Content-Type"),
			string(body),
			err,
		)
		return body, fmt.Errorf(msg)
	}
	if common.Code != 0 {
		errMsg := common.Msg
		if errMsg == "" {
			errMsg = common.Message
		}
		return body, fmt.Errorf("[doubao_new] API error (code: %d): %s", common.Code, errMsg)
	}
	if resp != nil {
		if err = json.Unmarshal(body, resp); err != nil {
			return body, err
		}
	}

	return body, nil
}

func getCookieValue(cookie, name string) string {
	parts := strings.Split(cookie, ";")
	prefix := name + "="
	for _, part := range parts {
		part = strings.TrimSpace(part)
		if strings.HasPrefix(part, prefix) {
			return strings.TrimPrefix(part, prefix)
		}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Decode the code number: auth/session codes → refresh the driver's cookies; quota codes → free space; rate-limit codes → back off and retry slower
  2. Re-authenticate the doubao driver in OpenList settings and retry
  3. Verify the target path exists and the operation is valid for it
  4. If code is unrecognized and all operations fail, check for an API change and update the driver
  5. Add delays between rapid successive operations to avoid frequency-limit codes
Defensive patterns

Strategy: try-catch

Type guard

func isAuthCodeError(err error) bool {
    m := regexp.MustCompile(`API error \(code: (\d+)\)`).FindStringSubmatch(err.Error())
    return m != nil && isDoubaoAuthCode(m[1]) // maintain a small auth-code set
}

Try / catch

if err := d.apiCall(...); err != nil {
    if isAuthCodeError(err) {
        d.refreshSession() // re-login, then retry once
        return d.apiCall(...)
    }
    if isRateLimitCode(err) {
        time.Sleep(5 * time.Second)
        return d.apiCall(...)
    }
    return err
}

Prevention

When it happens

Trigger: Any doubao_new API call hitting a business failure: expired session cookie (auth code), invalid folder token, quota exceeded, file name not allowed, rate limiting, or operation not permitted for the account state.

Common situations: Cookie-based auth going stale (most common — re-login fixes it), uploading to a deleted/moved folder, hitting operation frequency limits during heavy listing/upload, or Doubao A/B testing new endpoints that need updated parameters.

Related errors


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