{"record":{"id":"1d0c7dc139f0ad9e","repo":"jackwener/OpenCLI","slug":"failed-to-fetch-danjuan-account-details-faileda","errorCode":null,"errorMessage":"Failed to fetch Danjuan account details: ${failedAccounts}","messagePattern":"Failed to fetch Danjuan account details: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"clis/xueqiu/danjuan-utils.js","lineNumber":123,"sourceCode":"      };\n    })()\n  `);\n    if (raw?._httpError) {\n        throw new Error(`HTTP ${raw._httpError} — Hint: not logged in to ${DANJUAN_DOMAIN}?`);\n    }\n    if (raw?._emptyAccounts) {\n        throw new Error(`No fund accounts found — Hint: not logged in to ${DANJUAN_DOMAIN}?`);\n    }\n    if (Array.isArray(raw?.detailErrors) && raw.detailErrors.length > 0) {\n        const failedAccounts = raw.detailErrors\n            .map((item) => {\n            const label = item.accountName && item.accountId\n                ? `${item.accountName} (${item.accountId})`\n                : item.accountName || item.accountId || 'unknown account';\n            return `${label}: ${item.error}`;\n        })\n            .join(', ');\n        throw new Error(`Failed to fetch Danjuan account details: ${failedAccounts}`);\n    }\n    return raw;\n}\n","sourceCodeStart":105,"sourceCodeEnd":127,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xueqiu/danjuan-utils.js#L105-L127","documentation":"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.","triggerScenarios":"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.","commonSituations":"Danjuan rate-limiting rapid successive account-detail calls, transient network drops mid-snapshot, or a specific sub-account having restricted/inaccessible details.","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)."],"exampleFix":"// before\nclis/xueqiu danjuan-funds   # Failed to fetch Danjuan account details: 账户A (123): timeout\n// after (wait and retry, or reduce frequency)\nclis/xueqiu danjuan-funds","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const snapshot = await fetchDanjuanAll(page);\n} catch (err) {\n  if (err.message.startsWith('Failed to fetch Danjuan account details')) {\n    await sleep(5000);\n    const snapshot = await fetchDanjuanAll(page); // per-account failures are often transient\n  } else throw err;\n}","preventionTips":["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."],"tags":["network","partial-failure","danjuan"],"backgroundTag":"partial-fetch-failure","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}