jackwener/OpenCLI · error · AuthRequiredError
linux.do
Error message
linux.do
What it means
The linux-do auth verification first checks for the Discourse '_t' session cookie for https://linux.do. If it is absent or empty, verifyLinuxDoIdentity throws AuthRequiredError('linux.do', ...) because identity cannot be verified while anonymous.
Source
Thrown at clis/linux-do/auth.js:11
import { AuthRequiredError, CommandExecutionError } from '@jackwener/opencli/errors';
import { registerSiteAuthCommands } from '../_shared/site-auth.js';
async function hasLinuxDoSessionCookie(page) {
const cookies = await page.getCookies({ url: 'https://linux.do' });
return cookies.some(c => c.name === '_t' && c.value);
}
async function verifyLinuxDoIdentity(page) {
if (!await hasLinuxDoSessionCookie(page)) {
throw new AuthRequiredError('linux.do', 'Linux.do _t cookie missing — anonymous');
}
await page.goto('https://linux.do/');
await page.wait(2);
const probe = await page.evaluate(`(async () => {
try {
const u = document.querySelector('meta[name="current-user-username"]')?.getAttribute('content') || '';
if (!u) return { kind: 'auth', detail: 'Linux.do meta[current-user-username] missing — anonymous' };
const r = await fetch('/u/' + encodeURIComponent(u) + '.json', {
credentials: 'include',
headers: { Accept: 'application/json' },
});
if (r.status === 401 || r.status === 403) {
return { kind: 'auth', detail: 'Linux.do /u/<self>.json HTTP ' + r.status };
}
if (!r.ok) return { kind: 'http', httpStatus: r.status };
const d = await r.json();
const user = d?.user;
if (!user || !user.id) return { kind: 'auth', detail: 'Linux.do /u/<self>.json missing user.id' };View on GitHub (pinned to 49907e53dc)
Solutions
- Log in at https://linux.do/login in the linked browser so the '_t' cookie is set
- Re-run the linux-do auth login/verify command after signing in
- Check you are using the same browser profile that holds the linux.do session
- If the cookie keeps vanishing, review browser privacy settings/cookie auto-clear policies
Defensive patterns
Strategy: validation
Validate before calling
const cookies = await page.getCookies({ url: 'https://linux.do' });
if (!cookies.some(c => c.name === '_t' && c.value)) {
throw new Error('linux.do _t cookie missing; run the login flow first');
} Type guard
const hasLinuxDoSession = (cookies) => Array.isArray(cookies) && cookies.some(c => c.name === '_t' && c.value);
Try / catch
try {
await verifyLinuxDoIdentity(page);
} catch (e) {
if (e.name === 'AuthRequiredError') {
await linuxDoLogin(); // opens https://linux.do/login
return verifyLinuxDoIdentity(page);
} else throw e;
} Prevention
- Log in at https://linux.do/login before running verify
- Use a persistent browser profile for the linux.do session
- Re-check the quickCheck (_t cookie) before batch operations
- Beware browser privacy settings that auto-clear cookies
When it happens
Trigger: Calling the linux-do auth verify/status flow with a browser profile that has never logged into linux.do, or whose '_t' cookie has expired/been cleared.
Common situations: Fresh automation browser profile; cookie purge by browser policy or expiry (Discourse '_t' rotates/expires); logging out of linux.do manually; wrong browser profile selected.
Related errors
- auth
- Band band_session cookie missing
- Bilibili creator-center login is required: ${message}
- LinkedIn JSESSIONID cookie not found. Please sign in to Link
- ${context} requires an active signed-in LinkedIn browser ses
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/064c75e0268dadd8.
Report an issue: GitHub.