jackwener/OpenCLI · info · AuthRequiredError

Waiting for Douban dbcl2 / ck cookies

Error message

Waiting for Douban dbcl2 / ck cookies

What it means

The douban poll hook runs while waiting for the user to finish logging in. Until hasDoubanSessionCookie sees dbcl2 or ck, it throws AuthRequiredError with 'Waiting for Douban dbcl2 / ck cookies' — this is the expected 'still waiting' signal, not a fatal failure.

Source

Thrown at clis/douban/auth.js:59

  `);
  if (probe?.kind === 'unknown' && cookieUid) {
    return { user_id: cookieUid, name: '' };
  }
  if (probe?.kind === 'auth') throw new AuthRequiredError('douban.com', probe.detail);
  if (!probe?.ok) throw new CommandExecutionError(`Unexpected Douban probe: ${JSON.stringify(probe)}`);
  return { user_id: probe.user_id, name: probe.name };
}

registerSiteAuthCommands({
  site: 'douban',
  domain: 'douban.com',
  loginUrl: 'https://accounts.douban.com/passport/login',
  columns: ['user_id', 'name'],
  quickCheck: hasDoubanSessionCookie,
  verify: verifyDoubanIdentity,
  poll: async (page) => {
    if (!await hasDoubanSessionCookie(page)) {
      throw new AuthRequiredError('douban.com', 'Waiting for Douban dbcl2 / ck cookies');
    }
    return verifyDoubanIdentity(page);
  },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Complete the login in the browser window that opencli opened (accounts.douban.com/passport/login)
  2. If already logged in elsewhere, redo it in the managed profile so cookies land where the poller looks
  3. Keep polling — the error clears automatically once dbcl2/ck appear
Defensive patterns

Strategy: retry

Validate before calling

const cookies = await page.getCookies({ url: 'https://www.douban.com' });
if (!cookies.some(c => c.name === 'dbcl2' || c.name === 'ck')) {
  console.log('Waiting for you to log in at accounts.douban.com/passport/login ...');
}

Type guard

function hasDoubanSessionCookie(cookies) { return cookies.some(c => c.name === 'dbcl2' || c.name === 'ck'); }

Try / catch

try { await pollForAuth(); } catch (e) { if (e instanceof AuthRequiredError && /Waiting for/.test(e.message)) { /* keep polling */ } else throw e; }

Prevention

When it happens

Trigger: Polling starts before the user completes login at accounts.douban.com/passport/login; cookies not yet set in the profile being watched; login done in a different browser/profile than the one polled.

Common situations: User delays or abandons the interactive login; login completed in an incognito window instead of the managed profile; slow redirect delaying cookie set.

Related errors


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