jackwener/OpenCLI · info · AuthRequiredError
Waiting for Kimi auth cookies
Error message
Waiting for Kimi auth cookies
What it means
During interactive login polling, the poll function first checks hasKimiSessionCookie; if the access_token cookie has not appeared yet, it throws AuthRequiredError('Waiting for Kimi auth cookies') so the login flow keeps polling until the user completes sign-in. It is a progress signal during `kimi login`, not a hard failure of an API call.
Source
Thrown at clis/kimi/auth.js:53
}
})()`);
if (result?.kind === 'auth') throw new AuthRequiredError('kimi.com', result.detail);
if (result?.kind === 'http') throw new CommandExecutionError(`HTTP ${result.httpStatus} from /api/user`);
if (result?.kind === 'exception') throw new CommandExecutionError(`Kimi whoami failed: ${result.detail}`);
if (!result?.ok) throw new CommandExecutionError(`Unexpected Kimi probe: ${JSON.stringify(result)}`);
return { user_id: result.user_id, name: result.name };
}
registerSiteAuthCommands({
site: 'kimi',
domain: 'kimi.com',
loginUrl: 'https://www.kimi.com/',
columns: ['user_id', 'name'],
quickCheck: hasKimiSessionCookie,
verify: verifyKimiIdentity,
poll: async (page) => {
if (!await hasKimiSessionCookie(page)) {
throw new AuthRequiredError('kimi.com', 'Waiting for Kimi auth cookies');
}
return verifyKimiIdentity(page);
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Complete the login in the opened browser window and wait — polling continues automatically
- Check for interstitial steps (2FA, captcha, email confirm) blocking cookie issuance
- Confirm you are signing in on www.kimi.com so the cookie lands on the polled domain
- Restart the login flow if the window was closed or the session expired mid-login
Example fix
// before
await startKimiLogin(); // keep polling until cookies appear
// after
const session = await waitForAuthCompletion({
poll,
timeoutMs: 120000, // give the user time for 2FA etc.
onPollError: (e) => log('waiting for cookies: ' + e.message),
}); Defensive patterns
Strategy: retry
Validate before calling
const cookies = await page.getCookies({ url: 'https://www.kimi.com' });
const loggedIn = cookies.some(c => c.name === 'access_token');
console.log(loggedIn ? 'session ready' : 'still waiting for user to log in'); Type guard
function isAuthRequiredWaiting(e) {
return e instanceof AuthRequiredError && /Waiting for Kimi auth cookies/.test(e.message);
} Try / catch
try {
await kimiLoginPoll(page);
} catch (e) {
if (isAuthRequiredWaiting(e)) {
await sleep(3000); // poll again — user still logging in
return kimiLoginPoll(page);
}
throw e;
} Prevention
- Use a generous polling timeout (2-5 min) to accommodate 2FA
- Prompt the user clearly to complete sign-in in the opened window
- Detect final success via hasKimiSessionCookie before stopping the poll
When it happens
Trigger: Running the kimi login/poll flow and scanning cookies before the user finishes signing in at kimi.com — the access_token cookie simply is not set yet.
Common situations: User is slow to complete login (2FA, email verification); login page redirected to a flow that sets cookies on a different domain timing; polling started before the browser navigated to the login URL; user abandoned the login window.
Related errors
- Waiting for Jike login: ${detail}
- Waiting for Jimeng login
- Waiting for Ke lianjia_token cookie
- Waiting for LinkedIn li_at cookie
- Waiting for Nowcoder login
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/8483e8633f51f6de.
Report an issue: GitHub.