{"record":{"id":"c6cc60b63ad75639","repo":"jackwener/OpenCLI","slug":"unexpected-weibo-probe-json-stringify-result","errorCode":null,"errorMessage":"Unexpected Weibo probe: ${JSON.stringify(result)}","messagePattern":"Unexpected Weibo probe: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/weibo/auth.js","lineNumber":53,"sourceCode":"async function verifyWeiboIdentity(page) {\n  if (!await hasWeiboSessionCookie(page)) {\n    throw new AuthRequiredError('weibo.com', 'Weibo SUB / SUBP cookies missing');\n  }\n  await page.goto('https://weibo.com/');\n  await page.wait(3);\n  // getSelfUid throws AuthRequiredError when no logged-in uid can be resolved.\n  const uid = await getSelfUid(page);\n  if (typeof uid !== 'string' || !uid.trim()) {\n    throw new CommandExecutionError('Weibo uid resolver returned a malformed uid');\n  }\n  const result = unwrapEvaluateResult(await page.evaluate(buildWeiboIdentityProbe(uid)));\n  if (result?.kind === 'auth') throw new AuthRequiredError('weibo.com', result.detail);\n  if (result?.kind === 'http') throw new CommandExecutionError(`HTTP ${result.httpStatus} from /ajax/profile/info`);\n  if (result?.kind === 'exception') throw new CommandExecutionError(`Weibo whoami failed: ${result.detail}`);\n  if (!result || Array.isArray(result) || typeof result !== 'object') {\n    throw new CommandExecutionError('Weibo whoami returned malformed probe payload');\n  }\n  if (!result?.ok) throw new CommandExecutionError(`Unexpected Weibo probe: ${JSON.stringify(result)}`);\n  if (!result.user_id) throw new CommandExecutionError('Weibo whoami returned no user id');\n  return { user_id: result.user_id, screen_name: result.screen_name, profile_url: result.profile_url };\n}\n\nregisterSiteAuthCommands({\n  site: 'weibo',\n  domain: 'weibo.com',\n  loginUrl: 'https://weibo.com/login',\n  columns: ['user_id', 'screen_name', 'profile_url'],\n  quickCheck: hasWeiboSessionCookie,\n  verify: verifyWeiboIdentity,\n  poll: async (page) => {\n    if (!await hasWeiboSessionCookie(page)) {\n      throw new AuthRequiredError('weibo.com', 'Waiting for Weibo SUB / SUBP cookies');\n    }\n    return verifyWeiboIdentity(page);\n  },\n});","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/weibo/auth.js#L35-L71","documentation":"The probe returned a well-formed object but without any of the expected discriminated kinds (auth/http/exception) and without ok:true. The library cannot classify the payload, so it throws with the full JSON stringified for debugging. This is a catch-all for unexpected probe shapes.","triggerScenarios":"The in-page probe returns {kind:'unknown'} or a bare object without ok/user fields, e.g. the profile info endpoint replied with an unrecognized envelope, or a Weibo API version change altered the response JSON.","commonSituations":"Weibo server-side A/B changes returning new response shapes, rate-limit/blocked responses that aren't classic HTTP errors, or an outdated library whose probe expectations no longer match Weibo's /ajax/profile/info output.","solutions":["Inspect the JSON in the error message to see the actual payload and diagnose the mismatch","Check whether Weibo is rate-limiting or serving a captcha page; slow down and retry later","Re-login to refresh cookies; stale sessions often produce unusual responses","Update the library to a version that understands the new Weibo response shape"],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"// detect unclassifiable probe payloads before proceeding\nif (result && typeof result === 'object' && !Array.isArray(result) &&\n    !['auth','http','exception'].includes(result.kind) && !result.ok) {\n  console.error('unrecognized probe payload:', JSON.stringify(result));\n}","typeGuard":"function isRecognizedProbe(r) {\n  return r !== null && typeof r === 'object' && !Array.isArray(r) &&\n    (['auth','http','exception'].includes(r.kind) || r.ok === true);\n}","tryCatchPattern":"try {\n  identity = await verifyWeiboIdentity(page);\n} catch (err) {\n  if (/Unexpected Weibo probe/.test(err.message)) {\n    console.error(err.message); // JSON payload aids diagnosis\n    // back off and retry later, or re-login\n  } else throw err;\n}","preventionTips":["Log the full JSON payload from the message for diagnosis","Slow request cadence to avoid Weibo rate limits / captcha challenges","Re-login when payloads look unusual; stale cookies yield odd responses","Keep the CLI updated so probe parsing matches current Weibo API shapes"],"tags":["weibo","browser-automation","unexpected-response"],"backgroundTag":"unexpected-probe-response","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}