{"record":{"id":"1d95c18dbd076abd","repo":"jackwener/OpenCLI","slug":"bilibili-creator-comparison","errorCode":null,"errorMessage":"Bilibili creator comparison","messagePattern":"Bilibili creator comparison","errorType":"exception","errorClass":"TimeoutError","httpStatus":null,"severity":"error","filePath":"clis/bilibili/creator-stats.js","lineNumber":84,"sourceCode":"    try {\n        const payload = await page.fetchJson(\n            `${MEMBER_ORIGIN}/x/web/data/archive_diagnose/compare?size=100`,\n            { timeoutMs: FETCH_TIMEOUT_SECONDS * 1000 },\n        );\n        return requirePayload(payload);\n    }\n    catch (error) {\n        if (\n            error instanceof AuthRequiredError\n            || error instanceof EmptyResultError\n            || error instanceof CommandExecutionError\n            || error instanceof TimeoutError\n        ) {\n            throw error;\n        }\n        const detail = `${error?.message ?? error} ${error?.hint ?? ''}`.trim();\n        if (/abort|timed?\\s*out|timeout/i.test(detail)) {\n            throw new TimeoutError('Bilibili creator comparison', FETCH_TIMEOUT_SECONDS);\n        }\n        if (/HTTP\\s+(401|403)|登录|passport|\\/login\\b/i.test(detail)) {\n            throw new AuthRequiredError('member.bilibili.com', `Bilibili creator-center login is required: ${detail}`);\n        }\n        throw new CommandExecutionError(`Bilibili creator comparison request failed: ${detail}`);\n    }\n}\n\nfunction selectTarget(list, bvid) {\n    const matches = [];\n    for (const item of list) {\n        if (!isRecord(item) || typeof item.bvid !== 'string' || !/^BV[0-9A-Za-z]{10}$/.test(item.bvid)) {\n            throw new CommandExecutionError('Bilibili creator comparison returned a malformed manuscript row');\n        }\n        if (item.bvid === bvid) matches.push(item);\n    }\n    if (matches.length > 1) {\n        throw new CommandExecutionError(`Bilibili creator comparison returned duplicate rows for ${bvid}`);","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/bilibili/creator-stats.js#L66-L102","documentation":"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.","triggerScenarios":"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'.","commonSituations":"Slow or unstable network/proxy; Bilibili throttling responses; the 15s FETCH_TIMEOUT_SECONDS being too tight for large accounts; DNS stalls.","solutions":["Retry the command — transient latency often resolves on a second attempt","Check network/proxy connectivity to member.bilibili.com (curl the URL from the same machine)","Raise FETCH_TIMEOUT_SECONDS if responses are consistently near 15s (e.g. for accounts with many manuscripts)","Log in again — an auth interstitial can stall the request until it times out"],"exampleFix":"// before\nconst FETCH_TIMEOUT_SECONDS = 15;\n\n// after (slow networks)\nconst FETCH_TIMEOUT_SECONDS = 30;","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const rows = await runCommand();\n} catch (e) {\n  if (e.name === 'TimeoutError') {\n    // retry with backoff; check connectivity to member.bilibili.com\n  } else throw e;\n}","preventionTips":["Run on a stable network; avoid heavily throttled proxies/VPNs","Increase FETCH_TIMEOUT_SECONDS if accounts are large and responses are consistently slow","Retry transient timeouts with exponential backoff before surfacing to the user","Check member.bilibili.com reachability (curl) before debugging app code"],"tags":["bilibili","timeout","network","latency"],"backgroundTag":"request-timeout","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}