jackwener/OpenCLI · error · AuthRequiredError
Manus session cookies missing — anonymous
Error message
Manus session cookies missing — anonymous
What it means
verifyManusIdentity first checks the browser context for a Manus session cookie (auth_session, manus_token, _session, or session with a non-empty value) for https://manus.im. If none is present it throws AuthRequiredError because the CLI is operating anonymously and cannot prove the logged-in identity.
Source
Thrown at clis/manus/auth.js:11
import { AuthRequiredError, CommandExecutionError } from '@jackwener/opencli/errors';
import { registerSiteAuthCommands } from '../_shared/site-auth.js';
async function hasManusSessionCookie(page) {
const cookies = await page.getCookies({ url: 'https://manus.im' });
return cookies.some(c => /^(auth_session|manus_token|_session|session)$/.test(c.name) && c.value);
}
async function verifyManusIdentity(page) {
if (!await hasManusSessionCookie(page)) {
throw new AuthRequiredError('manus.im', 'Manus session cookies missing — anonymous');
}
await page.goto('https://manus.im/');
await page.wait(3);
const probe = await page.evaluate(`(async () => {
try {
const r = await fetch('/api/auth/session', { credentials: 'include', headers: { Accept: 'application/json' } });
if (r.status === 401 || r.status === 403) {
return { kind: 'auth', detail: 'Manus /api/auth/session HTTP ' + r.status };
}
if (r.status === 503) {
return { kind: 'http', httpStatus: 503 };
}
if (!r.ok) return { kind: 'http', httpStatus: r.status };
const d = await r.json();
const u = d?.user || d;
if (!u || !(u.id || u.userId)) {
return { kind: 'auth', detail: 'Manus /api/auth/session 200 but no user' };
}View on GitHub (pinned to 49907e53dc)
Solutions
- Run the manus login command and complete the interactive login at https://manus.im/login so session cookies are stored in the browser profile.
- Use a persistent browser user-data directory so cookies survive between CLI runs.
- Verify in the Manus web UI that you are actually logged in and the session has not been revoked.
- If cookies exist but aren't seen, check the cookie's domain matches https://manus.im (e.g. cookie set for a subdomain or different path won't match).
- Re-login if the session was invalidated server-side (password change, logout-everywhere, expired token).
Example fix
// before (fresh profile, no cookies) opencli manus whoami // AuthRequiredError: Manus session cookies missing — anonymous // after opencli manus login // complete browser login first opencli manus whoami // succeeds
Defensive patterns
Strategy: try-catch
Validate before calling
const cookies = await page.getCookies({ url: 'https://manus.im' });
const hasSession = cookies.some(c => /^(auth_session|manus_token|_session|session)$/.test(c.name) && c.value);
if (!hasSession) { await runManusLogin(); } Type guard
function hasManusSession(cookies) {
return cookies.some(c => /^(auth_session|manus_token|_session|session)$/.test(c.name) && !!c.value);
} Try / catch
try {
await manusWhoami();
} catch (e) {
if (e.name === 'AuthRequiredError' && /cookies missing/.test(e.message)) {
await manusLogin(); // interactive login, then retry once
} else throw e;
} Prevention
- Use a persistent browser user-data dir so session cookies survive runs.
- Run manus login before scripted commands in fresh CI environments.
- Detect AuthRequiredError early and trigger re-login instead of failing the whole job.
- Periodically re-validate the session and refresh cookies before expiry.
When it happens
Trigger: Running any manus auth command (login/whoami/list) when the automation browser profile has no Manus session cookie — e.g. never logged in, cookies cleared, fresh/ephemeral browser profile, cookies expired and purged, or page.getCookies filtered to a different URL/domain than where the cookie was set.
Common situations: Running the CLI in CI or a container with a throwaway browser profile; clearing browser cookies or switching profiles; running before ever completing the interactive manus login; system clock issues causing cookie expiry and cleanup; a proxy or domain mismatch so cookies stored under another URL are not returned for manus.im.
Related errors
- AuthRequiredError('gitee.com', probe.detail)
- auth
- Instagram sessionid cookie missing
- ${context} requires an active signed-in LinkedIn browser ses
- Manus /api/auth/session HTTP ${r.status}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/944bfcc538c053fb.
Report an issue: GitHub.