jackwener/OpenCLI · error · Error

No fund accounts found — Hint: not logged in to ${DANJUAN_DO

Error message

No fund accounts found — Hint: not logged in to ${DANJUAN_DOMAIN}?

What it means

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.

Source

Thrown at clis/xueqiu/danjuan-utils.js:112

      return {
        asOf:                root.daily_gain_date || null,
        totalAssetAmount:    n(root.amount),
        totalAssetDailyGain: n(root.daily_gain),
        totalAssetHoldGain:  n(root.hold_gain),
        totalAssetTotalGain: n(root.total_gain),
        totalFundMarketValue:n(fundSec && fundSec.amount),
        accounts,
        holdings,
        detailErrors,
      };
    })()
  `);
    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

  1. Re-login to danjuanfunds.com in the tool's browser session and retry.
  2. Verify in a normal browser that the account actually has fund accounts.
  3. Confirm the imported cookies belong to the intended logged-in Danjuan user.
  4. If the account truly has no funds, this outcome is expected — use a different account.

Example fix

// before
clis/xueqiu danjuan-funds   # No fund accounts found
// after (log in to danjuanfunds.com first)
clis/xueqiu danjuan-funds
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const snapshot = await fetchDanjuanAll(page);
} catch (err) {
  if (err.message.startsWith('No fund accounts found')) {
    // refresh login cookies; if still empty, the account genuinely has no fund accounts
  } else throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: Expired Danjuan session, scraping a Danjuan account that actually has no fund accounts configured, or cookie import that captured the wrong (anonymous) session.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/5204dd65d805ce4c. Report an issue: GitHub.