{"record":{"id":"11c3ac1d21f86a7a","repo":"jackwener/OpenCLI","slug":"waiting-for-manus-session-cookies","errorCode":null,"errorMessage":"Waiting for Manus session cookies","messagePattern":"Waiting for Manus session cookies","errorType":"validation","errorClass":"AuthRequiredError","httpStatus":null,"severity":"info","filePath":"clis/manus/auth.js","lineNumber":50,"sourceCode":"      return { kind: 'exception', detail: String(e && e.message || e) };\n    }\n  })()`);\n  if (probe?.kind === 'auth') throw new AuthRequiredError('manus.im', probe.detail);\n  if (probe?.kind === 'http') throw new CommandExecutionError(`HTTP ${probe.httpStatus} from Manus /api/auth/session`);\n  if (probe?.kind === 'exception') throw new CommandExecutionError(`Manus whoami failed: ${probe.detail}`);\n  if (!probe?.ok) throw new CommandExecutionError(`Unexpected Manus probe: ${JSON.stringify(probe)}`);\n  return { user_id: probe.user_id, name: probe.name };\n}\n\nregisterSiteAuthCommands({\n  site: 'manus',\n  domain: 'manus.im',\n  loginUrl: 'https://manus.im/login',\n  columns: ['user_id', 'name'],\n  verify: verifyManusIdentity,\n  poll: async (page) => {\n    if (!await hasManusSessionCookie(page)) {\n      throw new AuthRequiredError('manus.im', 'Waiting for Manus session cookies');\n    }\n    return verifyManusIdentity(page);\n  },\n});\n","sourceCodeStart":32,"sourceCodeEnd":55,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/manus/auth.js#L32-L55","documentation":"This AuthRequiredError is thrown by the poll callback that runs repeatedly while the user completes the browser login flow at manus.im/login. Until a recognized session cookie (auth_session, manus_token, _session, or session) with a non-empty value exists for the manus.im domain, the poller treats the user as still logged out and keeps waiting.","triggerScenarios":"Calling any manus auth/whoami command before completing login: the browser session at manus.im has no session cookie yet — either the user hasn't signed in, the login page hasn't finished setting cookies, or existing cookies were cleared or expired.","commonSituations":"First-time setup before logging in; the login flow was interrupted or the tab closed before sign-in completed; corporate SSO redirect loops; cookies blocked by browser settings or extensions; Manus renamed its session cookie so the regex no longer matches.","solutions":["Complete the login in the opened browser window at https://manus.im/login and let the poller continue","Verify manus.im cookies are not blocked (check browser privacy/extension settings) and retry","Manually confirm you can see your account on manus.im in the automation browser, then rerun the command","If Manus changed its cookie name, update the regex in hasManusSessionCookie in clis/manus/auth.js"],"exampleFix":"// before (narrow cookie-name match fails if Manus renames its cookie)\nreturn cookies.some(c => /^(auth_session|manus_token|_session|session)$/.test(c.name) && c.value);\n// after (broader match as a fallback)\nreturn cookies.some(c => /^(auth_session|manus_token|_session|session|manus-session.*|.*session.*token)$/i.test(c.name) && c.value);","handlingStrategy":"retry","validationCode":"const cookies = await page.getCookies({ url: 'https://manus.im' });\nconst hasSession = cookies.some(c => /^(auth_session|manus_token|_session|session)$/.test(c.name) && c.value);\nif (!hasSession) await openLoginPageAndAwaitLogin('https://manus.im/login');","typeGuard":"function hasManusSession(cookies) {\n  return Array.isArray(cookies) && cookies.some(\n    c => typeof c?.name === 'string' && /^(auth_session|manus_token|_session|session)$/.test(c.name) && !!c.value\n  );\n}","tryCatchPattern":"try {\n  const identity = await pollAuth(page);\n} catch (e) {\n  if (e instanceof AuthRequiredError && /Waiting for Manus session cookies/.test(e.message)) {\n    await promptUserToCompleteLogin('https://manus.im/login');\n    return pollAuth(page); // retry after the user signs in\n  }\n  throw e;\n}","preventionTips":["Complete the browser login before running any manus commands","Don't clear cookies between runs if using a persistent site session","Check that the automation browser isn't blocking third-party or session cookies","If login never completes, verify the cookie name hasn't changed in Manus"],"tags":["auth","cookies","login","polling"],"backgroundTag":"session-cookie-missing","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}