jackwener/OpenCLI · info · AuthRequiredError
Waiting for Facebook c_user cookie
Error message
Waiting for Facebook c_user cookie
What it means
This is the polling hook of the Facebook login-wait flow: while the user completes login in the browser, poll repeatedly checks for the c_user cookie. Until it appears, poll throws AuthRequiredError with the informational message 'Waiting for Facebook c_user cookie' — this is the expected, transient state during login, not a hard failure. Once the cookie shows up, poll delegates to verifyFacebookIdentity for full verification.
Source
Thrown at clis/facebook/auth.js:39
throw new AuthRequiredError('www.facebook.com', `Facebook /me redirected to ${finalUrl} — logged out or in checkpoint`);
}
return {
user_id: String(cUser),
vanity: String(vanity),
profile_url: `https://www.facebook.com/${vanity}/`,
};
}
registerSiteAuthCommands({
site: 'facebook',
domain: 'facebook.com',
loginUrl: 'https://www.facebook.com/login.php',
columns: ['user_id', 'vanity', 'profile_url'],
quickCheck: hasFacebookCUserCookie,
verify: verifyFacebookIdentity,
poll: async (page) => {
if (!await hasFacebookCUserCookie(page)) {
throw new AuthRequiredError('www.facebook.com', 'Waiting for Facebook c_user cookie');
}
return verifyFacebookIdentity(page);
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Keep waiting — the CLI's login-wait loop treats this as the normal in-progress state and retries until the cookie appears.
- Complete the Facebook login in the automated browser window (including 2FA) so c_user gets set.
- If polling keeps failing after login succeeded, check cookies via page.getCookies({url:'https://www.facebook.com'}) for a non-empty c_user.
- Restart the login flow with a clean page if the login window was closed or timed out.
Example fix
// before
await loginAndPoll(page); // surfaces AuthRequiredError while waiting
// after
try {
await loginAndPoll(page);
} catch (err) {
if (!(err instanceof AuthRequiredError && err.message === 'Waiting for Facebook c_user cookie')) {
throw err; // only unexpected auth errors should propagate
}
} Defensive patterns
Strategy: retry
Validate before calling
const cookies = await page.getCookies({ url: 'https://www.facebook.com' });
if (!cookies.some(c => c.name === 'c_user' && c.value)) {
// still logged out — show 'waiting for login' UI and keep polling
} Type guard
function isWaitingForLogin(err) {
return err instanceof AuthRequiredError && err.message === 'Waiting for Facebook c_user cookie';
} Try / catch
while (!done) {
try {
result = await poll(page);
done = true;
} catch (err) {
if (!(err instanceof AuthRequiredError)) throw err;
await sleep(2000); // expected while the user completes login
}
} Prevention
- Treat this specific AuthRequiredError message as 'keep polling', not a failure.
- Set a sensible overall login timeout so abandoned logins do not poll forever.
- Check that c_user appears with a non-empty value — empty strings do not count.
- Surface a 'complete login in the browser' prompt so users know why it is waiting.
When it happens
Trigger: Calling the poll callback (page) while the user is on the Facebook login page and has not yet completed login: hasFacebookCUserCookie(page) returns false because no non-empty c_user cookie is set yet.
Common situations: User still typing credentials mid-login; user abandoned the login window; Facebook showed an intermediate page (2FA) that has not yet set c_user; automation started polling before the login page even loaded.
Related errors
- Waiting for Boss wt2 / t cookies
- Facebook c_user cookie missing — anonymous session
- 12306 tk auth cookie missing
- amazon.com
- Waiting for Bilibili session cookies
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/64fb12e5068d682c.
Report an issue: GitHub.