{"record":{"id":"5204dd65d805ce4c","repo":"jackwener/OpenCLI","slug":"no-fund-accounts-found-hint-not-logged-in-to","errorCode":null,"errorMessage":"No fund accounts found — Hint: not logged in to ${DANJUAN_DOMAIN}?","messagePattern":"No fund accounts found — Hint: not logged in to (.+?)\\?","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"clis/xueqiu/danjuan-utils.js","lineNumber":112,"sourceCode":"\n      return {\n        asOf:                root.daily_gain_date || null,\n        totalAssetAmount:    n(root.amount),\n        totalAssetDailyGain: n(root.daily_gain),\n        totalAssetHoldGain:  n(root.hold_gain),\n        totalAssetTotalGain: n(root.total_gain),\n        totalFundMarketValue:n(fundSec && fundSec.amount),\n        accounts,\n        holdings,\n        detailErrors,\n      };\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":94,"sourceCodeEnd":127,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xueqiu/danjuan-utils.js#L94-L127","documentation":"fetchDanjuanAll throws this Error when the in-page evaluation reports _emptyAccounts — the Danjuan API responded successfully but returned zero fund accounts. The library treats this as a login/session symptom because logged-out sessions typically get an empty accounts payload rather than an error status.","triggerScenarios":"raw._emptyAccounts is truthy: the Danjuan accounts endpoint returned an empty list, most commonly because cookies are invalid so the server behaves as an anonymous user, or genuinely because the account has no fund accounts linked.","commonSituations":"Expired Danjuan session, scraping a Danjuan account that actually has no fund accounts configured, or cookie import that captured the wrong (anonymous) session.","solutions":["Re-login to danjuanfunds.com in the tool's browser session and retry.","Verify in a normal browser that the account actually has fund accounts.","Confirm the imported cookies belong to the intended logged-in Danjuan user.","If the account truly has no funds, this outcome is expected — use a different account."],"exampleFix":"// before\nclis/xueqiu danjuan-funds   # No fund accounts found\n// after (log in to danjuanfunds.com first)\nclis/xueqiu danjuan-funds","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const snapshot = await fetchDanjuanAll(page);\n} catch (err) {\n  if (err.message.startsWith('No fund accounts found')) {\n    // refresh login cookies; if still empty, the account genuinely has no fund accounts\n  } else throw err;\n}","preventionTips":["Re-login to danjuanfunds.com before long-running or scheduled jobs.","Confirm the account has fund accounts in the Danjuan web UI.","Ensure imported cookies belong to the correct logged-in user."],"tags":["authentication","cookies","empty-result","danjuan"],"backgroundTag":"not-logged-in-session-expired","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}