{"record":{"id":"211ee7fb21a62403","repo":"jackwener/OpenCLI","slug":"http-probe-httpstatus-from-jike-users-profile","errorCode":null,"errorMessage":"HTTP ${probe.httpStatus} from Jike users/profile","messagePattern":"HTTP (.+?) from Jike users/profile","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/jike/utils.js","lineNumber":31,"sourceCode":"    if (!token) return { kind: 'auth', detail: 'Jike JK_ACCESS_TOKEN missing from localStorage (anonymous)' };\n    const r = await fetch('https://api.ruguoapp.com/1.0/users/profile', {\n      headers: { 'x-jike-access-token': token, Accept: 'application/json' },\n    });\n    if (r.status === 401 || r.status === 403) return { kind: 'auth', detail: 'Jike users/profile HTTP ' + r.status };\n    if (!r.ok) return { kind: 'http', httpStatus: r.status };\n    const d = await r.json();\n    const u = d && d.user;\n    if (!u || !u.id) return { kind: 'auth', detail: 'Jike users/profile returned no user (anonymous)' };\n    return { ok: true, user_id: String(u.id), screen_name: String(u.screenName || ''), username: String(u.username || '') };\n  } catch (e) {\n    return { kind: 'exception', detail: String(e && e.message || e) };\n  }\n})()`;\n\nexport async function requireJikeIdentity(page) {\n  const probe = await page.evaluate(JIKE_IDENTITY_PROBE);\n  if (probe?.kind === 'auth') throw new AuthRequiredError('web.okjike.com', probe.detail);\n  if (probe?.kind === 'http') throw new CommandExecutionError(`HTTP ${probe.httpStatus} from Jike users/profile`);\n  if (probe?.kind === 'exception') throw new CommandExecutionError(`Jike identity probe failed: ${probe.detail}`);\n  if (!probe?.ok) throw new CommandExecutionError(`Unexpected Jike identity probe: ${JSON.stringify(probe)}`);\n  return { user_id: probe.user_id, screen_name: probe.screen_name, username: probe.username };\n}\n\nexport function normalizeJikeLimit(raw, defaultValue = 20) {\n  const limit = raw ?? defaultValue;\n  if (!Number.isInteger(limit) || limit < 1) {\n    throw new ArgumentError('--limit must be a positive integer');\n  }\n  return limit;\n}\n\nexport async function postJikeApi(page, path, requestBody, label) {\n  const url = `https://api.ruguoapp.com${path}`;\n  const outcome = await page.evaluate(`(async () => {\n    const token = localStorage.getItem('JK_ACCESS_TOKEN') || '';\n    const deviceId = localStorage.getItem('JK_DEVICE_ID') || '';","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/jike/utils.js#L13-L49","documentation":"CommandExecutionError thrown by requireJikeIdentity when the identity probe reports kind 'http': the Jike users/profile API responded with an unexpected non-OK HTTP status (anything other than 2xx, 401, or 403). This signals a server-side or rate-limit problem rather than an authentication one.","triggerScenarios":"Calling requireJikeIdentity while api.ruguoapp.com/1.0/users/profile returns e.g. 429 (rate limited), 500/502/503 (server error), or 404 from an API change.","commonSituations":"Hammering the API with rapid repeated commands triggering rate limiting; Jike API outage or maintenance window; a deployed API version change moving the endpoint.","solutions":["Wait and retry with backoff — 429/5xx are usually transient","Check Jike API status by hitting the endpoint manually in the logged-in browser","Reduce command frequency if rate limiting is suspected","Update the CLI in case the profile endpoint path changed"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const identity = await verifyJikeIdentity(page);\n} catch (e) {\n  if (/HTTP \\d+ from Jike users\\/profile/.test(e.message) && !e.message.includes('HTTP 401') && !e.message.includes('HTTP 403')) {\n    await sleep(backoff);\n    return verifyJikeIdentity(page); // retry with backoff\n  }\n  throw e;\n}","preventionTips":["Throttle command frequency to avoid 429 rate limits","Retry with exponential backoff on 5xx","Monitor Jike API availability during outages","Update the CLI if the endpoint path changes"],"tags":["http","api","rate-limit"],"backgroundTag":"http-5xx","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}