{"record":{"id":"9fb8aa4843b97b13","repo":"jackwener/OpenCLI","slug":"waiting-for-upwork-session-cookies","errorCode":null,"errorMessage":"Waiting for Upwork session cookies","messagePattern":"Waiting for Upwork session cookies","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"warning","filePath":"clis/upwork/auth.js","lineNumber":49,"sourceCode":"        ciphertext: String(profile.ciphertext || ''),\n      };\n    })()\n  `);\n  if (probe?.kind === 'auth') throw new AuthRequiredError('upwork.com', probe.detail);\n  if (!probe?.ok) throw new CommandExecutionError(`Unexpected Upwork probe: ${JSON.stringify(probe)}`);\n  return { user_id: probe.user_id, ciphertext: probe.ciphertext };\n}\n\nregisterSiteAuthCommands({\n  site: 'upwork',\n  domain: 'upwork.com',\n  loginUrl: 'https://www.upwork.com/ab/account-security/login',\n  columns: ['user_id', 'ciphertext'],\n  quickCheck: hasUpworkSessionCookie,\n  verify: verifyUpworkIdentity,\n  poll: async (page) => {\n    if (!await hasUpworkSessionCookie(page)) {\n      throw new AuthRequiredError('upwork.com', 'Waiting for Upwork session cookies');\n    }\n    return verifyUpworkIdentity(page);\n  },\n});\n","sourceCodeStart":31,"sourceCodeEnd":54,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/upwork/auth.js#L31-L54","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Complete the sign-in at https://www.upwork.com/ab/account-security/login in the connected browser (including 2FA) and keep the tab open.","If login appears stuck, reload the login page and sign in again; verify cookies exist afterwards.","If this error persists after successful login, check you're using the same browser profile the CLI is attached to.","Treat repeated occurrences during poll as normal transient states — they resolve once cookies land; only act if the poll ultimately times out."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const cookies = await page.cookies('https://www.upwork.com');\nconst ready = cookies.some(c => c.name === 'master_access_token');\nconsole.log(ready ? 'Session detected' : 'Still waiting for login…');","typeGuard":"function sessionReady(cookies) {\n  const names = new Set(cookies.map(c => c.name));\n  return names.has('master_access_token') || (names.has('XSRF-TOKEN') && names.has('user_uid'));\n}","tryCatchPattern":"try {\n  await pollForLogin(page);\n} catch (e) {\n  if (e instanceof AuthRequiredError && /Waiting for Upwork session cookies/.test(e.message)) {\n    console.log('Finish signing in at https://www.upwork.com/ab/account-security/login (incl. 2FA).');\n  } else throw e;\n}","preventionTips":["Keep the login tab open and complete 2FA/CAPTCHA promptly during the login flow.","Watch for silent login failures (wrong password) that keep cookies from appearing.","Confirm the login happens in the same browser profile the CLI polls.","Allow a generous poll timeout for manual steps like email verification."],"tags":["auth","login-flow","polling","upwork"],"backgroundTag":"missing-session-cookies","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}