jackwener/OpenCLI · info · AuthRequiredError

Waiting for Ke lianjia_token cookie

Error message

Waiting for Ke lianjia_token cookie

What it means

This is the polling signal thrown by the ke site's poll callback while the login flow waits for the user to finish signing in. As long as no non-empty `lianjia_token` cookie exists on www.ke.com, poll throws AuthRequiredError('Waiting for Ke lianjia_token cookie') so the auth loop keeps waiting; it is an expected intermediate state, not a failure of your command.

Source

Thrown at clis/ke/auth.js:44

        return { kind: 'auth', detail: 'Ke no user-name DOM anchor — anonymous or SSR failed' };
      }
      return { ok: true, username };
    })()
  `);
  if (probe?.kind === 'auth') throw new AuthRequiredError('ke.com', probe.detail);
  if (!probe?.ok) throw new CommandExecutionError(`Unexpected Ke probe: ${JSON.stringify(probe)}`);
  return { username: probe.username };
}

registerSiteAuthCommands({
  site: 'ke',
  domain: 'ke.com',
  loginUrl: 'https://clogin.ke.com/login/?service=https%3A%2F%2Fwww.ke.com',
  columns: ['username'],
  verify: verifyKeIdentity,
  poll: async (page) => {
    if (!await hasKeSessionCookie(page)) {
      throw new AuthRequiredError('ke.com', 'Waiting for Ke lianjia_token cookie');
    }
    return verifyKeIdentity(page);
  },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Complete the login in the opened browser window (SMS/QR code)
  2. Make sure the redirect lands back on www.ke.com so the service ticket is exchanged for the lianjia_token cookie
  3. If finished but still polling, reload www.ke.com in the browser to force cookie issuance, or restart the auth command
Defensive patterns

Strategy: retry

Validate before calling

const cookies = await page.getCookies({ url: 'https://www.ke.com' });
const ready = cookies.some(c => c.name === 'lianjia_token' && c.value);
if (!ready) console.log('Login still pending — complete it in the browser window');

Try / catch

// poll loop: treat this AuthRequiredError as 'keep waiting'
const deadline = Date.now() + 5 * 60_000;
while (Date.now() < deadline) {
  try { return await kePoll(page); }
  catch (e) {
    if (e instanceof AuthRequiredError && /Waiting for Ke lianjia_token/.test(e.message)) {
      await new Promise(r => setTimeout(r, 2000)); continue;
    }
    throw e;
  }
}
throw new Error('Login not completed within 5 minutes');

Prevention

When it happens

Trigger: Running the interactive ke auth login flow and the poller checking the browser before the user has completed the clogin.ke.com login; login completed but the cookie is not yet set for url https://www.ke.com.

Common situations: User hasn't finished (or abandoned) the browser login; login succeeded on clogin.ke.com but the service-ticket redirect back to www.ke.com hasn't happened yet, so the token cookie isn't issued.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/e8c4a35da254ccad. Report an issue: GitHub.