{"record":{"id":"bbd5b5d8a5f99659","repo":"jackwener/OpenCLI","slug":"jike-identity-probe-failed-probe-detail","errorCode":null,"errorMessage":"Jike identity probe failed: ${probe.detail}","messagePattern":"Jike identity probe failed: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/jike/utils.js","lineNumber":32,"sourceCode":"    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') || '';\n    if (!token) return { kind: 'auth', detail: 'Jike access token is missing' };","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/jike/utils.js#L14-L50","documentation":"CommandExecutionError thrown by requireJikeIdentity when the in-page probe script threw an exception (kind 'exception'); the browser-side error message is interpolated as probe.detail. The probe's fetch/JSON parse/localStorage access failed inside the page context.","triggerScenarios":"Calling requireJikeIdentity when the probe's page.evaluate body throws: fetch blocked by CSP or network, response.json() failing on non-JSON body, localStorage access denied (e.g. cookies disabled or browser privacy mode blocking storage).","commonSituations":"Browser configured to block third-party requests or disable site data; corporate proxy/HTTPS interception breaking the fetch; page still loading/navigating when the probe runs.","solutions":["Read the interpolated detail message for the underlying cause","Enable cookies/site data for web.okjike.com in the driven browser","Wait for the page to fully load before running identity verification","Check network/proxy settings that could block api.ruguoapp.com"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const identity = await verifyJikeIdentity(page);\n} catch (e) {\n  if (String(e.message).startsWith('Jike identity probe failed')) {\n    console.error('Probe exception:', e.message);\n    // fix browser/network config, then retry\n  } else throw e;\n}","preventionTips":["Enable cookies/site data for web.okjike.com in the driven browser","Wait for full page load before running verification","Check proxies/HTTPS interception that break fetch to api.ruguoapp.com","Read the interpolated detail message for the root cause"],"tags":["browser","fetch","network"],"backgroundTag":"browser-evaluate-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}