jackwener/OpenCLI · error · AuthRequiredError
linux.do requires an active signed-in browser session
Error message
linux.do requires an active signed-in browser session
What it means
linux.do is a login-only Discourse site; the JSON topic endpoint answers 401/403 when there is no authenticated browser session. The library maps those statuses to AuthRequiredError telling the user to sign in via the browser the CLI controls.
Source
Thrown at clis/linux-do/topic-content.js:110
}
return {
ok: res.ok,
status: res.status,
data,
error: data === null ? 'Response is not valid JSON' : '',
};
} catch (error) {
return {
ok: false,
error: error instanceof Error ? error.message : String(error),
};
}
})()`);
if (!result) {
throw new CommandExecutionError('linux.do returned an empty browser response');
}
if (result.status === 401 || result.status === 403) {
throw new AuthRequiredError(LINUX_DO_DOMAIN, 'linux.do requires an active signed-in browser session');
}
if (result.error === 'Response is not valid JSON') {
throw new AuthRequiredError(LINUX_DO_DOMAIN, 'linux.do requires an active signed-in browser session');
}
if (!result.ok) {
throw new CommandExecutionError(result.error || `linux.do request failed: HTTP ${result.status ?? 'unknown'}`);
}
if (result.error) {
throw new CommandExecutionError(result.error, 'Please verify your linux.do session is still valid');
}
return result.data;
}
cli({
site: 'linux-do',
name: 'topic-content',
access: 'read',
description: 'Get the main topic body as Markdown',
domain: LINUX_DO_DOMAIN,View on GitHub (pinned to 49907e53dc)
Solutions
- Sign in to linux.do in the CLI-managed browser (run the auth/login command and complete login).
- Reuse a persistent browser profile that already holds a valid session.
- Complete any Cloudflare/captcha challenge interactively once, then retry.
- Verify the session works by opening a topic in that browser manually.
Example fix
// before npx cli --site linux-do --name topic-content 12345 // after npx cli --site linux-do login # complete sign-in once npx cli --site linux-do --name topic-content 12345
Defensive patterns
Strategy: try-catch
Validate before calling
// check session before fetching
const sessionOk = await page.evaluate(() => document.cookie.includes('_t') || document.querySelector('.current-user') !== null); Type guard
const isAuthError = (e) => e?.name === 'AuthRequiredError' || /signed-in browser session/.test(e?.message ?? '');
Try / catch
try {
return await fetchTopicPayload(page, id);
} catch (e) {
if (isAuthError(e)) {
console.error('Run the linux.do login command to establish a session.');
} else throw e;
} Prevention
- Log in once with a persistent browser profile
- Re-login when cookies expire
- Complete anti-bot challenges interactively
When it happens
Trigger: fetchTopicPayload's in-page fetch receives HTTP 401 or 403 — anonymous session, expired linux.do login, Cloudflare/bot challenge rejecting the request, or cookies cleared.
Common situations: Running the CLI in a fresh browser profile never logged in to linux.do; session cookie expired; site behind anti-bot protection requiring interactive challenge; using headless mode with no stored session.
Related errors
- Please verify your linux.do session is still valid
- Twitter device-follow returned HTTP ${data.error}
- 未获取到课程列表
- Chaoxing session cookies missing
- ChatGPT project requires a logged-in ChatGPT session.
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/d1ca564022e9219c.
Report an issue: GitHub.