docmirror/dev-sidecar · warning
百度云账号 ${config.id} 的接口 ${api} 已超出限额
Error message
百度云账号 ${config.id} 的接口 ${api} 已超出限额 What it means
The Baidu OCR request interceptor cycles through configured Baidu Cloud accounts/API quotas. When every remaining account's API has exceeded its QPS/daily quota (checkIsLimitConfig returns true for all), getConfig logs this warning per exhausted account and eventually returns null, meaning no OCR interception is applied and requests pass through untranslated.
Source
Thrown at packages/mitmproxy/src/lib/interceptor/impl/req/baiduOcr.js:81
} else {
config = interceptOpt.baiduOcr
tryCount = null // 将tryCount设置为null代表只有一个配置
}
if (!config || !config.id || !config.ak || !config.sk) {
return null // 没有配置或配置错误,直接返回null
}
// 选择当前配置可用的API。
// 注意:不将结果写入共享的 config 对象,而是作为局部变量返回,避免并发请求互相覆盖。
let selectedApi = null
for (let i = 0; i < apis.length; i++) {
const api = apis[i]
if (!checkIsLimitConfig(config.id, api)) {
selectedApi = api
break
}
log.warn(`百度云账号 ${config.id} 的接口 ${api} 已超出限额`)
}
// 如果当前配置的所有API均不可用,则返回null
if (selectedApi == null) {
if (tryCount == null) {
return null // 只配置了一个账号,没有更多账号可以选择了,直接返回null
} else {
if (tryCount < interceptOpt.baiduOcr.length) {
// 递归找到有效的配置
return getConfig(interceptOpt, tryCount + 1, log)
} else {
return null
}
}
}
return { config, api: selectedApi }
}View on GitHub (pinned to 7710cd56cc)
Solutions
- Add more Baidu Cloud accounts or API configurations to the baiduOcr config so rotation has alternatives.
- Check quota usage in the Baidu Cloud console and upgrade the API tier (raise purchased QPS) for the exhausted interface.
- Wait for the quota window (per-second or daily) to reset; the limit checker will recover automatically.
- Confirm config.id entries and api names in config match what Baidu actually provisioned (typos make every api look limited).
Example fix
// before
"baiduOcr": { "accounts": [{ "id": "acct1", "apis": ["standard"] }] }
// after: add second account
"baiduOcr": { "accounts": [{ "id": "acct1", "apis": ["standard"] }, { "id": "acct2", "apis": ["standard"] }] } Defensive patterns
Strategy: retry
Validate before calling
const quota = await checkBaiduQuota(account) // or track QPS client-side if (quota.remaining <= 0) rotateToNextAccount()
Try / catch
try { result = await ocrRequest() } catch (e) { if (e.code === 'QPS_LIMIT') scheduleRetry(nextAccount) } Prevention
- Track per-account QPS/daily quotas client-side and rotate before exhausting
- Provision multiple accounts or a paid API tier
- Monitor Baidu Cloud console usage alerts
When it happens
Trigger: pdf/image requests matching the OCR interceptor when all configured baiduOcr accounts have hit the rate limit for their assigned API tier (e.g. free-tier standard_qps exhausted), so the for-loop over `apis` finds no non-limited api.
Common situations: Free-tier Baidu accounts used heavily; single account after a traffic spike; multiple accounts all provisioned on the same limited API type; forgetting to upgrade API quota in Baidu Cloud console.
Related errors
AI-assisted analysis of docmirror/dev-sidecar@7710cd56cc (2026-08-31).
Data as JSON: /api/errors/5beb16972366008e.
Report an issue: GitHub.