{"record":{"id":"236d25d2fa3ec66d","repo":"jackwener/OpenCLI","slug":"http-probe-httpstatus-from-maimai","errorCode":null,"errorMessage":"HTTP ${probe.httpStatus} from Maimai","messagePattern":"HTTP (.+?) from Maimai","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/maimai/auth.js","lineNumber":34,"sourceCode":"    }\n    if (!user || !user.id) return { kind: 'auth', detail: 'Maimai userObj missing from page (anonymous)' };\n    return {\n      ok: true,\n      user_id: String(user.id),\n      name: String(user.name || ''),\n      company: String(user.company || ''),\n    };\n  } catch (e) {\n    return { kind: 'exception', detail: String(e && e.message || e) };\n  }\n})()`;\n\nasync function verifyMaimaiIdentity(page) {\n  await page.goto('https://maimai.cn/');\n  await page.wait(2);\n  const probe = await page.evaluate(WHOAMI_PROBE);\n  if (probe?.kind === 'auth') throw new AuthRequiredError('maimai.cn', probe.detail);\n  if (probe?.kind === 'http') throw new CommandExecutionError(`HTTP ${probe.httpStatus} from Maimai`);\n  if (probe?.kind === 'exception') throw new CommandExecutionError(`Maimai whoami failed: ${probe.detail}`);\n  if (!probe?.ok) throw new CommandExecutionError(`Unexpected Maimai probe: ${JSON.stringify(probe)}`);\n  return { user_id: probe.user_id, name: probe.name, company: probe.company };\n}\n\nregisterSiteAuthCommands({\n  site: 'maimai',\n  domain: 'maimai.cn',\n  loginUrl: 'https://maimai.cn/',\n  columns: ['user_id', 'name', 'company'],\n  verify: verifyMaimaiIdentity,\n  poll: verifyMaimaiIdentity,\n});\n","sourceCodeStart":16,"sourceCodeEnd":48,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/maimai/auth.js#L16-L48","documentation":"Thrown at clis/maimai/auth.js:34 when the probe result has kind:'http', wrapping the HTTP status of a failed page load as `HTTP <status> from Maimai`. It indicates verifyMaimaiIdentity could not obtain a healthy maimai.cn page (note: the current WHOAMI_PROBE never emits kind 'http'; this branch is a defensive path for probe variants/envs that do).","triggerScenarios":"A probe reporting kind:'http' with an httpStatus — i.e. page.goto to https://maimai.cn/ returned an error status (5xx, 403 WAF block) or a browser fetch interceptor reported one, before the whoami script could run.","commonSituations":"Maimai WAF/anti-bot blocking the automation browser; maimai.cn outage or 5xx; network proxy returning an error page; geo-blocking of the maimai homepage.","solutions":["Check https://maimai.cn/ in a normal browser to see if the site is up or blocking you","If 403/anti-bot, use a real logged-in Chrome profile and disable headless automation signals","Retry later if it's a 5xx outage","Check proxy/VPN settings that might alter the response"],"exampleFix":"// before\nawait verifyMaimaiIdentity(page);\n// after\ntry {\n  await verifyMaimaiIdentity(page);\n} catch (e) {\n  if (/HTTP 5\\d\\d from Maimai/.test(e.message)) {\n    await new Promise(r => setTimeout(r, 10000));\n    return verifyMaimaiIdentity(page);\n  }\n  throw e;\n}","handlingStrategy":"retry","validationCode":"// pre-check site reachability\nconst res = await fetch('https://maimai.cn/', { method: 'HEAD' });\nif (res.status >= 500) throw new Error(`maimai.cn is unhealthy: HTTP ${res.status}`);","typeGuard":"function isMaimaiHttpError(e) {\n  return e instanceof Error && /^HTTP \\d{3} from Maimai$/.test(e.message);\n}","tryCatchPattern":"try {\n  await verifyMaimaiIdentity(page);\n} catch (e) {\n  if (isMaimaiHttpError(e) && /5\\d\\d/.test(e.message)) {\n    await sleep(10000);\n    return verifyMaimaiIdentity(page);\n  }\n  throw e;\n}","preventionTips":["Check maimai.cn availability in a normal browser first","Use a residential network/avoid proxies that trigger WAF blocks","Retry with backoff on 5xx; don't hammer the endpoint","Run with a real, non-headless logged-in Chrome profile to reduce bot detection"],"tags":["network","http","browser-automation","waf"],"backgroundTag":"http-5xx-api-response","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}