jackwener/OpenCLI · error · Error
Failed to fetch Danjuan account details: ${failedAccounts}
Error message
Failed to fetch Danjuan account details: ${failedAccounts} What it means
When the overall Danjuan snapshot succeeds but some individual account-detail fetches failed, fetchDanjuanAll collects raw.detailErrors, formats them as 'label: error' pairs joined by commas, and throws this Error listing the failed accounts. It signals partial data loss — holdings for the listed accounts could not be retrieved.
Source
Thrown at clis/xueqiu/danjuan-utils.js:123
};
})()
`);
if (raw?._httpError) {
throw new Error(`HTTP ${raw._httpError} — Hint: not logged in to ${DANJUAN_DOMAIN}?`);
}
if (raw?._emptyAccounts) {
throw new Error(`No fund accounts found — Hint: not logged in to ${DANJUAN_DOMAIN}?`);
}
if (Array.isArray(raw?.detailErrors) && raw.detailErrors.length > 0) {
const failedAccounts = raw.detailErrors
.map((item) => {
const label = item.accountName && item.accountId
? `${item.accountName} (${item.accountId})`
: item.accountName || item.accountId || 'unknown account';
return `${label}: ${item.error}`;
})
.join(', ');
throw new Error(`Failed to fetch Danjuan account details: ${failedAccounts}`);
}
return raw;
}
View on GitHub (pinned to 49907e53dc)
Solutions
- Retry the command after a short delay — often a transient per-account fetch failure.
- Read the failedAccounts list to see which specific accounts failed; check those in the Danjuan web UI.
- Slow down request frequency / avoid concurrent heavy usage to dodge rate limiting.
- If a specific account always fails, verify its access in the Danjuan app (permissions/hidden account).
Example fix
// before clis/xueqiu danjuan-funds # Failed to fetch Danjuan account details: 账户A (123): timeout // after (wait and retry, or reduce frequency) clis/xueqiu danjuan-funds
Defensive patterns
Strategy: retry
Try / catch
try {
const snapshot = await fetchDanjuanAll(page);
} catch (err) {
if (err.message.startsWith('Failed to fetch Danjuan account details')) {
await sleep(5000);
const snapshot = await fetchDanjuanAll(page); // per-account failures are often transient
} else throw err;
} Prevention
- Add retry-with-backoff around snapshot fetches.
- Throttle request frequency to avoid per-account rate limiting.
- Note the failed account labels in the message and check them manually if persistent.
When it happens
Trigger: One or more per-account detail requests inside the page evaluation reject (network hiccup, per-account permission issue, rate limiting on repeated requests), producing detailErrors entries that get aggregated and thrown.
Common situations: Danjuan rate-limiting rapid successive account-detail calls, transient network drops mid-snapshot, or a specific sub-account having restricted/inaccessible details.
Related errors
- 12306 queryByTrainNo returned HTTP ${resp.status}
- 12306 queryByTrainNo returned non-JSON body
- 12306 ${endpoint} returned non-JSON body
- 12306 ${endpoint} returned an unexpected payload shape
- 12306 rejected every known query endpoint name (${QUERY_ENDP
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/1d0c7dc139f0ad9e.
Report an issue: GitHub.