jackwener/OpenCLI · error · AuthRequiredError
Cookie 已过期!请在当前 Chrome 浏览器中重新登录 Weibo。
Error message
Cookie 已过期!请在当前 Chrome 浏览器中重新登录 Weibo。
What it means
clis/weibo/delete.js:152 throws AuthRequiredError with this message when the in-page delete script reports error==='auth', meaning Weibo treated the request as unauthenticated. The command automates weibo.com through the user's current Chrome session, so it has no credentials of its own — it depends entirely on live login cookies. When those cookies are missing or expired, Weibo redirects/rejects and the CLI surfaces this error telling the user to re-login in Chrome.
Source
Thrown at clis/weibo/delete.js:152
try {
verifyBody = await verifyResp.json();
} catch {
return { ok: false, error: 'verify_malformed', msg: 'verify returned non-JSON response', id: idstr };
}
if (!verifyBody || typeof verifyBody !== 'object') {
return { ok: false, error: 'verify_malformed', msg: 'verify returned malformed response', id: idstr };
}
if (String(verifyBody.idstr || '') === idstr) {
return { ok: false, error: 'still_exists', id: idstr, mblogid: verifyBody.mblogid || mblogid };
}
if (!verifyBody.idstr || verifyBody.ok === 0) {
return { ok: true, id: idstr, mblogid };
}
return { ok: false, error: 'verify_mismatch', msg: 'verify returned a different post id', id: idstr };
})()
`)), 'weibo delete');
if (result.error === 'auth') {
throw new AuthRequiredError('weibo.com', 'Cookie 已过期!请在当前 Chrome 浏览器中重新登录 Weibo。');
}
if (result.error === 'not_found') {
throw new EmptyResultError('weibo delete', `Post not found for id "${String(result.input ?? raw)}". Verify the post still exists and belongs to the logged-in account.`);
}
if (result.error === 'show_http' || result.error === 'destroy_http' || result.error === 'verify_http') {
throw new CommandExecutionError(`weibo delete: HTTP ${result.status}`);
}
if (result.error === 'api' || result.error === 'verify_malformed' || result.error === 'verify_mismatch' || result.error === 'still_exists') {
throw new CommandExecutionError(`weibo delete: ${String(result.msg ?? result.error)}`);
}
if (!result.ok) {
throw new CommandExecutionError('weibo delete returned an unexpected response');
}
return [{ status: 'deleted', id: String(result.id ?? ''), mblogid: String(result.mblogid ?? '') }];
},
});
export const __test__ = {View on GitHub (pinned to 49907e53dc)
Solutions
- Open weibo.com in the current Chrome browser and log in manually, then retry the command
- Verify the Chrome profile the CLI attaches to is the one that is logged in (not a fresh/clean profile)
- If login keeps failing, clear weibo.com cookies and log in again, completing any SMS/QR security verification
- Avoid changing the account password right before use, which invalidates existing sessions
Example fix
// before: failing run $ opencli weibo delete 51aBcDeFgH AuthRequiredError: Cookie 已过期!请在当前 Chrome 浏览器中重新登录 Weibo。 // after: re-login then retry 1. chrome -> weibo.com -> log in 2. $ opencli weibo delete 51aBcDeFgH // succeeds
Defensive patterns
Strategy: try-catch
Validate before calling
// best-effort pre-check: cannot inspect Chrome cookies from Node; validate input instead
if (!id || !/^[A-Za-z0-9]{4,32}$/.test(String(id).trim())) throw new Error('invalid weibo post id'); Type guard
function isAuthRequiredError(e) { return e instanceof Error && /重新登录|AuthRequired/i.test(e.message); } Try / catch
try {
await cli.run('weibo delete', { id });
} catch (e) {
if (isAuthRequiredError(e)) {
console.error('Login to weibo.com in Chrome, then retry.');
process.exitCode = 2; // distinct auth exit code
} else throw e;
} Prevention
- Periodically open weibo.com in Chrome to keep the session alive
- Run auth-sensitive commands after confirming manual browsing works
- Never run these commands against a headless profile that was never logged in
- Watch for AuthRequiredError and stop the batch immediately instead of hammering
When it happens
Trigger: Running `weibo delete <id|url>` when the Chrome profile's weibo.com session cookie has expired or the user is logged out; result.error from the evaluate() script is exactly 'auth'.
Common situations: Chrome cookies expired after Weibo's session timeout (typically days-weeks); user logged out of weibo.com or logged into a different account; running the CLI from a headless/CI environment where the Chrome profile was never logged in; Weibo invalidating sessions after a security prompt or password change.
Related errors
- Cookie 已过期!请在当前 Chrome 浏览器中重新登录 BOSS 直聘。
- Ctrip flight API returned HTTP ${status}; complete any verif
- Flomo memos requires an active signed-in Flomo browser sessi
- Unexpected Hupu probe: ${JSON.stringify(probe)}
- ${probe.detail}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/aecf2037eee9f21b.
Report an issue: GitHub.