{"record":{"id":"a93dcccc85eec73d","repo":"jackwener/OpenCLI","slug":"upwork-redirected-to-login-open-https-www-upwor-a93dcc","errorCode":null,"errorMessage":"Upwork redirected to login. Open https://www.upwork.com in the connected browser and sign in, then retry.","messagePattern":"Upwork redirected to login\\. Open https://www\\.upwork\\.com in the connected browser and sign in, then retry\\.","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"error","filePath":"clis/upwork/feed.js","lineNumber":83,"sourceCode":"                const onLogin = /\\\\/(ab\\\\/account-security\\\\/login|nx\\\\/login)/.test(location.pathname);\n                const challenge = (document.title || '').toLowerCase().includes('just a moment') || !!document.querySelector('[id^=\"cf-\"]');\n                const state = window.__NUXT__ && window.__NUXT__.state && window.__NUXT__.state[key];\n                return {\n                    ready,\n                    onLogin,\n                    challenge,\n                    jobsPresent: !!(state && Object.prototype.hasOwnProperty.call(state, 'jobs')),\n                    jobs: state ? state.jobs : undefined,\n                    paging: state && state.paging ? state.paging : null,\n                };\n            })()`));\n        }\n        catch (e) {\n            throw new CommandExecutionError(`Failed to read Upwork feed state: ${e?.message ?? e}`, 'The Nuxt state global was not reachable; try again after opening Upwork in the connected browser.');\n        }\n\n        if (payload?.onLogin) {\n            throw new AuthRequiredError('upwork.com', 'Upwork redirected to login. Open https://www.upwork.com in the connected browser and sign in, then retry.');\n        }\n        if (payload?.challenge) {\n            throw new CommandExecutionError('Upwork served a Cloudflare challenge page', 'Open https://www.upwork.com in the connected browser and clear the challenge, then retry.');\n        }\n        if (!payload?.ready) {\n            throw new CommandExecutionError(`Upwork feed state (window.__NUXT__.state.${stateKey}) was not present within 15s`, 'The page may not have finished hydrating, or the SSR state shape may have changed.');\n        }\n        if (!isPlainObject(payload)) {\n            throw new CommandExecutionError('Upwork feed returned an unexpected Browser Bridge payload shape');\n        }\n        if (!payload.jobsPresent || !Array.isArray(payload.jobs)) {\n            throw new CommandExecutionError(`Upwork feed state had an unexpected jobs shape; expected window.__NUXT__.state.${stateKey}.jobs to be an array.`);\n        }\n\n        const jobs = payload.jobs;\n        if (jobs.length === 0) {\n            throw new EmptyResultError(`upwork feed ${tab}`, `Upwork ${tab} feed is empty for the current account`);\n        }","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/upwork/feed.js#L65-L101","documentation":"`upwork feed` requires an authenticated Upwork session. The in-page probe detects that the browser was redirected to Upwork's login page (paths /ab/account-security/login or /nx/login) instead of the feed, and throws AuthRequiredError naming upwork.com. This means the cookies in the connected browser are missing, expired, or invalid.","triggerScenarios":"Running `upwork feed` (or `upwork feed most-recent`) when the connected browser has no valid Upwork session: never logged in, session cookie expired, cookies cleared, or the cookie-sync strategy failed so Upwork bounces the feed URL to its login/onboarding flow.","commonSituations":"Session expired after a period of inactivity; user logged out or cleared cookies in the shared browser profile; running from a CI/machine whose browser profile was never authenticated; Upwork forcing re-authentication after a security event or password change.","solutions":["Open https://www.upwork.com in the connected browser and sign in manually, then re-run the command.","Verify the browser profile the CLI uses is the one where you logged in (cookie strategy depends on that profile's session cookies).","If sessions keep expiring, check whether Upwork flags the environment (new IP, headless signals) and complete any security verification.","Automate a pre-check: probe a page that requires auth before running batch jobs, and pause with a clear message when AuthRequiredError is thrown."],"exampleFix":"// before\nconst jobs = await upwork.feed();  // AuthRequiredError when session expired\n// after\ntry {\n  const jobs = await upwork.feed();\n} catch (e) {\n  if (e instanceof AuthRequiredError) {\n    console.error('Sign in at https://www.upwork.com in the connected browser, then rerun.');\n    process.exitCode = 2;\n  } else throw e;\n}","handlingStrategy":"try-catch","validationCode":"// pre-flight auth check: hit a members-only URL and see if it redirects to /nx/login\nconst redirected = await bridge.currentUrlStartsWith('https://www.upwork.com/ab/account-security/login');\nif (redirected) promptUserToSignIn();","typeGuard":null,"tryCatchPattern":"import { AuthRequiredError } from '@jackwener/opencli/errors';\ntry {\n  const jobs = await upwork.feed();\n} catch (e) {\n  if (e instanceof AuthRequiredError) {\n    console.error('Sign in to upwork.com in the connected browser, then retry.');\n    return null; // don't treat as a crash\n  }\n  throw e;\n}","preventionTips":["Sign in once in the dedicated browser profile and keep the session alive with occasional manual use.","Run the CLI from the same machine/network you normally log in from to avoid security re-auth triggers.","Pre-flight an auth probe before long batch runs and fail fast with a clear message.","Don't clear the profile's cookies between runs."],"tags":["upwork","authentication","auth-required","session-expired"],"backgroundTag":"auth-required","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}