{"record":{"id":"d1ca564022e9219c","repo":"jackwener/OpenCLI","slug":"linux-do-requires-an-active-signed-in-browser-sess-d1ca56","errorCode":null,"errorMessage":"linux.do requires an active signed-in browser session","messagePattern":"linux\\.do requires an active signed-in browser session","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"error","filePath":"clis/linux-do/topic-content.js","lineNumber":110,"sourceCode":"      }\n      return {\n        ok: res.ok,\n        status: res.status,\n        data,\n        error: data === null ? 'Response is not valid JSON' : '',\n      };\n    } catch (error) {\n      return {\n        ok: false,\n        error: error instanceof Error ? error.message : String(error),\n      };\n    }\n  })()`);\n    if (!result) {\n        throw new CommandExecutionError('linux.do returned an empty browser response');\n    }\n    if (result.status === 401 || result.status === 403) {\n        throw new AuthRequiredError(LINUX_DO_DOMAIN, 'linux.do requires an active signed-in browser session');\n    }\n    if (result.error === 'Response is not valid JSON') {\n        throw new AuthRequiredError(LINUX_DO_DOMAIN, 'linux.do requires an active signed-in browser session');\n    }\n    if (!result.ok) {\n        throw new CommandExecutionError(result.error || `linux.do request failed: HTTP ${result.status ?? 'unknown'}`);\n    }\n    if (result.error) {\n        throw new CommandExecutionError(result.error, 'Please verify your linux.do session is still valid');\n    }\n    return result.data;\n}\ncli({\n    site: 'linux-do',\n    name: 'topic-content',\n    access: 'read',\n    description: 'Get the main topic body as Markdown',\n    domain: LINUX_DO_DOMAIN,","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/linux-do/topic-content.js#L92-L128","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nnpx cli --site linux-do --name topic-content 12345\n// after\nnpx cli --site linux-do login   # complete sign-in once\nnpx cli --site linux-do --name topic-content 12345","handlingStrategy":"try-catch","validationCode":"// check session before fetching\nconst sessionOk = await page.evaluate(() => document.cookie.includes('_t') || document.querySelector('.current-user') !== null);","typeGuard":"const isAuthError = (e) => e?.name === 'AuthRequiredError' || /signed-in browser session/.test(e?.message ?? '');","tryCatchPattern":"try {\n  return await fetchTopicPayload(page, id);\n} catch (e) {\n  if (isAuthError(e)) {\n    console.error('Run the linux.do login command to establish a session.');\n  } else throw e;\n}","preventionTips":["Log in once with a persistent browser profile","Re-login when cookies expire","Complete anti-bot challenges interactively"],"tags":["auth","session","http-403","discourse"],"backgroundTag":"authentication-required","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}