{"record":{"id":"8128891cdc9b06c4","repo":"jackwener/OpenCLI","slug":"http-812889","errorCode":null,"errorMessage":"http","messagePattern":"http","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/linux-do/auth.js","lineNumber":36,"sourceCode":"      if (!u) return { kind: 'auth', detail: 'Linux.do meta[current-user-username] missing — anonymous' };\n      const r = await fetch('/u/' + encodeURIComponent(u) + '.json', {\n        credentials: 'include',\n        headers: { Accept: 'application/json' },\n      });\n      if (r.status === 401 || r.status === 403) {\n        return { kind: 'auth', detail: 'Linux.do /u/<self>.json HTTP ' + r.status };\n      }\n      if (!r.ok) return { kind: 'http', httpStatus: r.status };\n      const d = await r.json();\n      const user = d?.user;\n      if (!user || !user.id) return { kind: 'auth', detail: 'Linux.do /u/<self>.json missing user.id' };\n      return { ok: true, user_id: String(user.id), username: String(user.username || u), name: String(user.name || '') };\n    } catch (e) {\n      return { kind: 'exception', detail: String(e && e.message || e) };\n    }\n  })()`);\n  if (probe?.kind === 'auth') throw new AuthRequiredError('linux.do', probe.detail);\n  if (probe?.kind === 'http') throw new CommandExecutionError(`HTTP ${probe.httpStatus} from Linux.do /u/<self>.json`);\n  if (probe?.kind === 'exception') throw new CommandExecutionError(`Linux.do whoami failed: ${probe.detail}`);\n  if (!probe?.ok) throw new CommandExecutionError(`Unexpected Linux.do probe: ${JSON.stringify(probe)}`);\n  return { user_id: probe.user_id, username: probe.username, name: probe.name };\n}\n\nregisterSiteAuthCommands({\n  site: 'linux-do',\n  domain: 'linux.do',\n  loginUrl: 'https://linux.do/login',\n  columns: ['user_id', 'username', 'name'],\n  quickCheck: hasLinuxDoSessionCookie,\n  verify: verifyLinuxDoIdentity,\n  poll: async (page) => {\n    if (!await hasLinuxDoSessionCookie(page)) {\n      throw new AuthRequiredError('linux.do', 'Waiting for Linux.do _t cookie');\n    }\n    return verifyLinuxDoIdentity(page);\n  },","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/linux-do/auth.js#L18-L54","documentation":"If the /u/<self>.json fetch completes with a non-ok status other than 401/403 (e.g. 429, 5xx), the probe returns {kind:'http', httpStatus} and verifyLinuxDoIdentity throws CommandExecutionError `HTTP <status> from Linux.do /u/<self>.json`. This signals a server-side or rate-limit problem, not an auth failure.","triggerScenarios":"Discourse returning 429 (rate limit) or 5xx for the whoami endpoint while the session itself is valid.","commonSituations":"Hammering the linux.do API with repeated verify calls; linux.do server incident/maintenance window; Cloudflare returning 5xx; bot mitigation returning 429.","solutions":["Wait and retry after a backoff — most commonly a 429 rate-limit","Check linux.do status/uptime for a server-side incident","Reduce the frequency of auth verify/status polling","If Cloudflare is challenging, solve it once in the browser then retry"],"exampleFix":"// before (tight loop)\nwhile (!ok) verifyLinuxDoIdentity(page);\n// after\nawait new Promise(r => setTimeout(r, 30_000)); // backoff before retry\nverifyLinuxDoIdentity(page);","handlingStrategy":"retry","validationCode":"// Throttle your own polling; Discourse rate-limits /u/*.json\nawait new Promise(r => setTimeout(r, 30_000)); // min interval between verify calls","typeGuard":null,"tryCatchPattern":"const verifyWithRetry = async (page, attempts = 3) => {\n  for (let i = 0; i < attempts; i++) {\n    try { return await verifyLinuxDoIdentity(page); }\n    catch (e) {\n      if (/HTTP \\d+ from Linux\\.do/.test(e.message) && i < attempts - 1) {\n        await new Promise(r => setTimeout(r, 2 ** i * 15_000));\n        continue;\n      }\n      throw e;\n    }\n  }\n};","preventionTips":["Add exponential backoff between verify/poll calls","Avoid tight verification loops against Discourse endpoints","Monitor linux.do status for 5xx incidents during incidents","Use a session/IP that isn't already rate-limited"],"tags":["linux-do","http-error","rate-limit","discourse"],"backgroundTag":"http-5xx","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}