jackwener/OpenCLI · error · Error

HTTP ${raw._httpError} — Hint: not logged in to ${DANJUAN_DO

Error message

HTTP ${raw._httpError} — Hint: not logged in to ${DANJUAN_DOMAIN}?

What it means

fetchDanjuanAll in clis/xueqiu/danjuan-utils.js evaluates in-page JavaScript on danjuanfunds.com and inspects the returned raw object. If the page script recorded an _httpError status, it throws this Error because Danjuan's API did not return data — most often the browser session's cookies are missing/expired, i.e. the user is not logged in to danjuanfunds.com.

Source

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

          });
        }
      }

      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. Log in to danjuanfunds.com in the browser session used by the tool (refresh cookies via the cookie/COOKIE strategy login flow) and retry.
  2. Re-export fresh cookies from a logged-in browser if you supply them manually.
  3. Check the reported HTTP status code: 401/403 => auth problem; 5xx => retry later.
  4. Try from a different network/IP if anti-bot blocking is suspected.
  5. Verify danjuanfunds.com is reachable and not down for maintenance.

Example fix

// before (stale cookies)
clis/xueqiu danjuan-funds   # HTTP 401 — Hint: not logged in to danjuanfunds.com?
// after (re-login to refresh cookies, then)
clis/xueqiu danjuan-funds
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const snapshot = await fetchDanjuanAll(page);
} catch (err) {
  if (/^HTTP \d+/.test(err.message)) {
    // refresh danjuanfunds.com cookies / re-login, then retry
  } else throw err;
}

Prevention

When it happens

Trigger: The in-page fetch to Danjuan's account APIs returns a non-2xx status stored in raw._httpError — typically HTTP 401/403 from expired or absent login cookies, anti-bot rejection, or network failure during the browser session.

Common situations: Danjuan login cookie expired (their sessions rotate frequently), running headless without importing browser cookies, IP flagged by Danjuan's anti-scraping, or Danjuan serving a login redirect.

Related errors


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