{"record":{"id":"16c9fabdf5f04375","repo":"jackwener/OpenCLI","slug":"http-probe-httpstatus-from-jimeng-passport","errorCode":null,"errorMessage":"HTTP ${probe.httpStatus} from Jimeng passport","messagePattern":"HTTP (.+?) from Jimeng passport","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/jimeng/auth.js","lineNumber":29,"sourceCode":"  try {\n    const r = await fetch('/passport/account/info/v2/?aid=513695', { credentials: 'include', headers: { Accept: 'application/json' } });\n    if (r.status === 401 || r.status === 403) return { kind: 'auth', detail: 'Jimeng passport HTTP ' + r.status };\n    if (!r.ok) return { kind: 'http', httpStatus: r.status };\n    const d = await r.json();\n    const u = d && d.data;\n    if (!u || !u.user_id || u.is_visitor_account) return { kind: 'auth', detail: 'Jimeng passport returned a visitor account (anonymous)' };\n    return { ok: true, user_id: String(u.user_id_str || u.user_id), screen_name: String(u.screen_name || u.name || '') };\n  } catch (e) {\n    return { kind: 'exception', detail: String(e && e.message || e) };\n  }\n})()`;\n\nasync function verifyJimengIdentity(page) {\n  await page.goto('https://jimeng.jianying.com/ai-tool/generate?type=image&workspace=0');\n  await page.wait(2);\n  const probe = await page.evaluate(WHOAMI_PROBE);\n  if (probe?.kind === 'auth') throw new AuthRequiredError('jimeng.jianying.com', probe.detail);\n  if (probe?.kind === 'http') throw new CommandExecutionError(`HTTP ${probe.httpStatus} from Jimeng passport`);\n  if (probe?.kind === 'exception') throw new CommandExecutionError(`Jimeng whoami failed: ${probe.detail}`);\n  if (!probe?.ok) throw new CommandExecutionError(`Unexpected Jimeng probe: ${JSON.stringify(probe)}`);\n  return { user_id: probe.user_id, screen_name: probe.screen_name };\n}\n\nregisterSiteAuthCommands({\n  site: 'jimeng',\n  domain: 'jimeng.jianying.com',\n  loginUrl: 'https://jimeng.jianying.com/',\n  columns: ['user_id', 'screen_name'],\n  verify: verifyJimengIdentity,\n  poll: async (page) => {\n    const probe = await page.evaluate(WHOAMI_PROBE);\n    if (!probe?.ok) throw new AuthRequiredError('jimeng.jianying.com', 'Waiting for Jimeng login');\n    return { user_id: probe.user_id, screen_name: probe.screen_name };\n  },\n});\n","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/jimeng/auth.js#L11-L47","documentation":"When the in-page WHOAMI_PROBE's HTTP call to Jimeng passport completes with a non-OK HTTP status (kind 'http'), verifyJimengIdentity throws CommandExecutionError including the status. This means the identity check reached the passport server but got an error response, distinct from auth (401-style) or JS exceptions.","triggerScenarios":"The probe's fetch to the Jimeng passport endpoint returns a status like 403 (WAF/bot block), 429 (rate limit), or 5xx, with httpStatus carried back to the page-level evaluate result.","commonSituations":"Jimeng passport under heavy load (5xx); automated access blocked by anti-bot measures (403); too-frequent probes (429); regional restrictions or network middleware altering responses.","solutions":["Check the reported HTTP status: 5xx → retry later; 429 → wait and reduce probe frequency; 403 → investigate anti-bot blocking","Load jimeng.jianying.com manually in the attached Chrome and confirm normal browsing works","Retry after a delay; the failure may be transient","Disable proxies/VPN that could be blocked by Jimeng's edge","If it persists, verify the passport endpoint URL used by WHOAMI_PROBE is still current"],"exampleFix":"// before\nawait verifyJimengIdentity(page);\n// after\ntry {\n  await verifyJimengIdentity(page);\n} catch (err) {\n  if (/HTTP \\d+ from Jimeng passport/.test(err.message)) {\n    await new Promise(r => setTimeout(r, 5000)); // transient passport error\n    return verifyJimengIdentity(page);\n  }\n  throw err;\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":"function isJimengHttpStatusError(err) {\n  return err instanceof CommandExecutionError && /HTTP \\d+ from Jimeng passport/.test(err.message);\n}","tryCatchPattern":"try {\n  const identity = await verifyJimengIdentity(page);\n} catch (err) {\n  if (isJimengHttpStatusError(err) && /HTTP (429|5\\d\\d)/.test(err.message)) {\n    await sleep(5000);\n    return verifyJimengIdentity(page);\n  }\n  throw err;\n}","preventionTips":["Avoid probing the passport endpoint in tight loops (429 risk)","Retry 5xx with backoff; don't hammer the service","Disable proxies likely blocked by Jimeng's edge","Manually browse jimeng.jianying.com to confirm service health before automation"],"tags":["http","http-status","jimeng","passport"],"backgroundTag":"http-error-status","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}