jackwener/OpenCLI · warning · AuthRequiredError
Waiting for Ctrip login_uid cookie
Error message
Waiting for Ctrip login_uid cookie
What it means
The Ctrip login flow polls the browser page until the `login_uid` cookie appears, which indicates the user completed the login. If the cookie is still missing when the poll runs, the CLI throws AuthRequiredError to signal that interactive login has not happened yet. It is thrown by the ctrip auth command's `poll` hook after a failed `hasCtripLoginUid` check.
Source
Thrown at clis/ctrip/auth.js:46
userName = decodeURIComponent(userNameRaw);
} catch {
userName = userNameRaw;
}
}
const vipGrade = params.get('VipGrade') || '';
return { user_id: loginUid, name: userName, vip_grade: vipGrade };
}
registerSiteAuthCommands({
site: 'ctrip',
domain: 'ctrip.com',
loginUrl: 'https://passport.ctrip.com/user/login',
columns: ['user_id', 'name', 'vip_grade'],
quickCheck: hasCtripLoginUid,
verify: verifyCtripIdentity,
poll: async (page) => {
if (!await hasCtripLoginUid(page)) {
throw new AuthRequiredError('ctrip.com', 'Waiting for Ctrip login_uid cookie');
}
return verifyCtripIdentity(page);
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Complete the Ctrip login in the opened browser window (credentials or QR scan) so login_uid gets set, then rerun the auth command
- Rerun the auth flow and wait for it to finish rather than aborting early
- Check that passport.ctrip.com is reachable from your network (no proxy/firewall block)
- Verify cookies are persisted in the browser profile so subsequent runs reuse the login
Example fix
null
Defensive patterns
Strategy: retry
Validate before calling
// Before relying on auth state, probe for the cookie via the CLI's own helper
const hasUid = await hasCtripLoginUid(page);
if (!hasUid) {
console.warn('Ctrip login_uid missing — rerun the interactive auth flow first');
} Type guard
null
Try / catch
try {
await ctripAuthPoll(page);
} catch (e) {
if (e instanceof AuthRequiredError && /login_uid/.test(e.message)) {
// prompt user to complete login, then retry the poll
await waitForUserLogin(page);
return ctripAuthPoll(page);
}
throw e;
} Prevention
- Always run the auth command interactively and wait for the success message before other ctrip commands
- Use a persistent browser profile so login_uid survives across runs
- Never run the login poll headlessly without a human able to complete the login
- Re-run auth proactively when other ctrip commands report session problems
When it happens
Trigger: Running `clis/ctrip auth` (browser-based login) and calling the poll function before the user has actually submitted the Ctrip passport login form; the passport.ctrip.com/user/login page never sets login_uid because credentials were wrong, the QR code expired, or the user simply has not finished logging in.
Common situations: Running the auth command headlessly or unattended so nobody completes the login; Ctrip session expired and re-auth is needed; corporate proxy blocking passport.ctrip.com; user closes the browser before the cookie is written.
Related errors
- Waiting for Bilibili session cookies
- bilibili.com
- coupang.com
- Ctrip is asking for a captcha; complete it in your browser s
- Ctrip is asking for a captcha; complete it in your browser s
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/7e969a6ed3344b03.
Report an issue: GitHub.