jackwener/OpenCLI · error · Error

No fund accounts found — Hint: not logged in to danjuanfunds

Error message

No fund accounts found — Hint: not logged in to danjuanfunds.com?

What it means

The fund-holdings command calls fetchDanjuanAll and throws this Error when snapshot.accounts is empty. Like the danjuan-utils variant, it indicates the Danjuan session yielded no fund accounts — almost always because the browser session is not logged in to danjuanfunds.com, though a fund-account-free account produces the same result.

Source

Thrown at clis/xueqiu/fund-holdings.js:18

import { cli, Strategy } from '@jackwener/opencli/registry';
import { fetchDanjuanAll } from './danjuan-utils.js';
cli({
    site: 'xueqiu',
    name: 'fund-holdings',
    access: 'read',
    description: '获取蛋卷基金持仓明细(可用 --account 按子账户过滤)',
    domain: 'danjuanfunds.com',
    strategy: Strategy.COOKIE,
    navigateBefore: 'https://danjuanfunds.com/my-money',
    args: [
        { name: 'account', type: 'str', default: '', help: '按子账户名称或 ID 过滤' },
    ],
    columns: ['accountName', 'fdCode', 'fdName', 'marketValue', 'volume', 'dailyGain', 'holdGain', 'holdGainRate', 'marketPercent'],
    func: async (page, args) => {
        const snapshot = await fetchDanjuanAll(page);
        if (!snapshot.accounts.length) {
            throw new Error('No fund accounts found — Hint: not logged in to danjuanfunds.com?');
        }
        const filter = String(args.account ?? '').trim();
        const rows = filter
            ? snapshot.holdings.filter(h => h.accountId === filter || h.accountName.includes(filter))
            : snapshot.holdings;
        if (!rows.length) {
            throw new Error(filter ? `No holdings matched account filter: ${filter}` : 'No holdings found.');
        }
        return rows;
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Log in to danjuanfunds.com in the tool's browser session (refresh cookies) and rerun.
  2. Re-export fresh cookies from a logged-in browser if cookies are provided manually.
  3. Verify the Danjuan account actually has fund accounts in the web UI.
  4. Use the danjuan-funds command to sanity-check the session state before fund-holdings.

Example fix

// before
clis/xueqiu fund-holdings   # No fund accounts found — Hint: not logged in to danjuanfunds.com?
// after (login first)
clis/xueqiu fund-holdings --account 账户A
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const rows = await getFundHoldings(page);
} catch (err) {
  if (err.message.startsWith('No fund accounts found')) {
    // refresh danjuanfunds.com login cookies, then retry once
  } else throw err;
}

Prevention

When it happens

Trigger: Running the fund-holdings command with expired/absent danjuanfunds.com cookies so the accounts list comes back empty, or an account that has no fund accounts.

Common situations: Cookie expiration between runs, headless runs without cookie import, wrong cookies (anonymous session), or genuinely empty Danjuan fund account.

Related errors


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