jackwener/OpenCLI · error · AuthRequiredError
Bilibili creator-center login is required: ${detail}
Error message
Bilibili creator-center login is required: ${detail} What it means
Second classification branch in fetchComparison's catch: if the underlying error's message/hint matches /HTTP\s+(401|403)|登录|passport|\/login\b/i, the error is rethrown as AuthRequiredError('member.bilibili.com', ...). This catches HTTP-level 401/403 responses and passport/login redirects that occur before a JSON envelope exists.
Source
Thrown at clis/bilibili/creator-stats.js:87
{ 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}`);
}
if (matches.length === 0) {
throw new EmptyResultError(View on GitHub (pinned to 49907e53dc)
Solutions
- Log in to member.bilibili.com in the browser profile the CLI uses, then re-run the command
- Clear bilibili.com cookies and re-authenticate to obtain a fresh session
- Check whether your IP/network is being blocked (403) and try a different network
- Verify the CLI browser profile actually retains cookies (not incognito/headless with fresh storage)
Example fix
// before $ opencli bilibili creator-stats BV1xx411c7mD AuthRequiredError: Bilibili creator-center login is required: HTTP 403 ... passport.bilibili.com/login // after: re-login in the shared browser profile, then retry $ opencli bilibili creator-stats BV1xx411c7mD
Defensive patterns
Strategy: try-catch
Validate before calling
const res = await fetch('https://member.bilibili.com/platform/home', { headers: { cookie }, redirect: 'manual' });
if (res.status === 401 || res.status === 403 || (res.status >= 300 && /passport|login/.test(res.headers.get('location') || ''))) {
throw new Error('Session expired — re-login to member.bilibili.com first');
} Try / catch
try {
const rows = await runCommand();
} catch (e) {
if (e.name === 'AuthRequiredError') {
// launch interactive login to member.bilibili.com, then retry once
} else throw e;
} Prevention
- Pre-flight check for 401/403 or passport redirects before running the command
- Keep SESSDATA fresh; re-login before cookie expiry
- Avoid networks/IPs flagged by Bilibili risk control (403)
- Handle AuthRequiredError as a first-class flow: authenticate then retry
When it happens
Trigger: page.fetchJson receives an HTTP 401/403 from member.bilibili.com, or is redirected to passport.bilibili.com / a /login URL — session cookie absent, expired, or rejected at the HTTP layer rather than via an API code.
Common situations: Fully expired SESSDATA cookie causing a passport redirect; IP flagged by risk control returning 403; browser profile logged out; corporate proxy stripping cookies.
Related errors
- Bilibili creator-center login is required: ${message}
- LinkedIn Sales Navigator API auth failed (HTTP ' + (result.s
- Manus /api/auth/session HTTP ${r.status}
- Zhihu /api/v4/me returned HTTP ${status} — anonymous
- www.zhihu.com
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/48308c1303ccb34d.
Report an issue: GitHub.