jackwener/OpenCLI · warning · AuthRequiredError

Waiting for Upwork session cookies

Error message

Waiting for Upwork session cookies

What it means

During the interactive upwork.com login flow, the poll callback runs repeatedly while waiting for the user to sign in. Until hasUpworkSessionCookie detects the session cookies, it throws AuthRequiredError('Waiting for Upwork session cookies') to keep the login waiter looping until authentication completes.

Source

Thrown at clis/upwork/auth.js:49

        ciphertext: String(profile.ciphertext || ''),
      };
    })()
  `);
  if (probe?.kind === 'auth') throw new AuthRequiredError('upwork.com', probe.detail);
  if (!probe?.ok) throw new CommandExecutionError(`Unexpected Upwork probe: ${JSON.stringify(probe)}`);
  return { user_id: probe.user_id, ciphertext: probe.ciphertext };
}

registerSiteAuthCommands({
  site: 'upwork',
  domain: 'upwork.com',
  loginUrl: 'https://www.upwork.com/ab/account-security/login',
  columns: ['user_id', 'ciphertext'],
  quickCheck: hasUpworkSessionCookie,
  verify: verifyUpworkIdentity,
  poll: async (page) => {
    if (!await hasUpworkSessionCookie(page)) {
      throw new AuthRequiredError('upwork.com', 'Waiting for Upwork session cookies');
    }
    return verifyUpworkIdentity(page);
  },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Complete the sign-in at https://www.upwork.com/ab/account-security/login in the connected browser (including 2FA) and keep the tab open.
  2. If login appears stuck, reload the login page and sign in again; verify cookies exist afterwards.
  3. If this error persists after successful login, check you're using the same browser profile the CLI is attached to.
  4. Treat repeated occurrences during poll as normal transient states — they resolve once cookies land; only act if the poll ultimately times out.
Defensive patterns

Strategy: try-catch

Validate before calling

const cookies = await page.cookies('https://www.upwork.com');
const ready = cookies.some(c => c.name === 'master_access_token');
console.log(ready ? 'Session detected' : 'Still waiting for login…');

Type guard

function sessionReady(cookies) {
  const names = new Set(cookies.map(c => c.name));
  return names.has('master_access_token') || (names.has('XSRF-TOKEN') && names.has('user_uid'));
}

Try / catch

try {
  await pollForLogin(page);
} catch (e) {
  if (e instanceof AuthRequiredError && /Waiting for Upwork session cookies/.test(e.message)) {
    console.log('Finish signing in at https://www.upwork.com/ab/account-security/login (incl. 2FA).');
  } else throw e;
}

Prevention

When it happens

Trigger: Running the upwork login command and polling the page before the user has completed sign-in — the cookie set (master_access_token, or XSRF-TOKEN + user_uid) is not yet present in the browser.

Common situations: User is slow to finish login (2FA, CAPTCHA, email verification); login failed silently and cookies never appeared; user closed the login tab; polling started before the login page even loaded.

Related errors


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