jackwener/OpenCLI · error · TimeoutError

Bilibili creator comparison

Error message

Bilibili creator comparison

What it means

fetchComparison wraps the underlying page.fetchJson call; unexpected errors (those not already AuthRequiredError/EmptyResultError/CommandExecutionError/TimeoutError) are classified by regex on their message+hint. If the detail matches /abort|timed?\s*out|timeout/i, the error is normalized to TimeoutError('Bilibili creator comparison', 15). This gives the command a consistent timeout error type.

Source

Thrown at clis/bilibili/creator-stats.js:84

    try {
        const payload = await page.fetchJson(
            `${MEMBER_ORIGIN}/x/web/data/archive_diagnose/compare?size=100`,
            { timeoutMs: FETCH_TIMEOUT_SECONDS * 1000 },
        );
        return requirePayload(payload);
    }
    catch (error) {
        if (
            error instanceof AuthRequiredError
            || error instanceof EmptyResultError
            || error instanceof CommandExecutionError
            || error instanceof TimeoutError
        ) {
            throw error;
        }
        const detail = `${error?.message ?? error} ${error?.hint ?? ''}`.trim();
        if (/abort|timed?\s*out|timeout/i.test(detail)) {
            throw new TimeoutError('Bilibili creator comparison', FETCH_TIMEOUT_SECONDS);
        }
        if (/HTTP\s+(401|403)|登录|passport|\/login\b/i.test(detail)) {
            throw new AuthRequiredError('member.bilibili.com', `Bilibili creator-center login is required: ${detail}`);
        }
        throw new CommandExecutionError(`Bilibili creator comparison request failed: ${detail}`);
    }
}

function selectTarget(list, bvid) {
    const matches = [];
    for (const item of list) {
        if (!isRecord(item) || typeof item.bvid !== 'string' || !/^BV[0-9A-Za-z]{10}$/.test(item.bvid)) {
            throw new CommandExecutionError('Bilibili creator comparison returned a malformed manuscript row');
        }
        if (item.bvid === bvid) matches.push(item);
    }
    if (matches.length > 1) {
        throw new CommandExecutionError(`Bilibili creator comparison returned duplicate rows for ${bvid}`);

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry the command — transient latency often resolves on a second attempt
  2. Check network/proxy connectivity to member.bilibili.com (curl the URL from the same machine)
  3. Raise FETCH_TIMEOUT_SECONDS if responses are consistently near 15s (e.g. for accounts with many manuscripts)
  4. Log in again — an auth interstitial can stall the request until it times out

Example fix

// before
const FETCH_TIMEOUT_SECONDS = 15;

// after (slow networks)
const FETCH_TIMEOUT_SECONDS = 30;
Defensive patterns

Strategy: retry

Try / catch

try {
  const rows = await runCommand();
} catch (e) {
  if (e.name === 'TimeoutError') {
    // retry with backoff; check connectivity to member.bilibili.com
  } else throw e;
}

Prevention

When it happens

Trigger: The GET to member.bilibili.com/x/web/data/archive_diagnose/compare?size=100 with timeoutMs 15000 aborts or exceeds the deadline — slow network, Bilibili latency, or an AbortController timeout in the fetch layer whose message contains 'timeout'/'timed out'/'abort'.

Common situations: Slow or unstable network/proxy; Bilibili throttling responses; the 15s FETCH_TIMEOUT_SECONDS being too tight for large accounts; DNS stalls.

Related errors


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