jackwener/OpenCLI · error · CommandExecutionError

Unexpected Weibo probe: ${JSON.stringify(result)}

Error message

Unexpected Weibo probe: ${JSON.stringify(result)}

What it means

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.

Source

Thrown at clis/weibo/auth.js:53

async function verifyWeiboIdentity(page) {
  if (!await hasWeiboSessionCookie(page)) {
    throw new AuthRequiredError('weibo.com', 'Weibo SUB / SUBP cookies missing');
  }
  await page.goto('https://weibo.com/');
  await page.wait(3);
  // getSelfUid throws AuthRequiredError when no logged-in uid can be resolved.
  const uid = await getSelfUid(page);
  if (typeof uid !== 'string' || !uid.trim()) {
    throw new CommandExecutionError('Weibo uid resolver returned a malformed uid');
  }
  const result = unwrapEvaluateResult(await page.evaluate(buildWeiboIdentityProbe(uid)));
  if (result?.kind === 'auth') throw new AuthRequiredError('weibo.com', result.detail);
  if (result?.kind === 'http') throw new CommandExecutionError(`HTTP ${result.httpStatus} from /ajax/profile/info`);
  if (result?.kind === 'exception') throw new CommandExecutionError(`Weibo whoami failed: ${result.detail}`);
  if (!result || Array.isArray(result) || typeof result !== 'object') {
    throw new CommandExecutionError('Weibo whoami returned malformed probe payload');
  }
  if (!result?.ok) throw new CommandExecutionError(`Unexpected Weibo probe: ${JSON.stringify(result)}`);
  if (!result.user_id) throw new CommandExecutionError('Weibo whoami returned no user id');
  return { user_id: result.user_id, screen_name: result.screen_name, profile_url: result.profile_url };
}

registerSiteAuthCommands({
  site: 'weibo',
  domain: 'weibo.com',
  loginUrl: 'https://weibo.com/login',
  columns: ['user_id', 'screen_name', 'profile_url'],
  quickCheck: hasWeiboSessionCookie,
  verify: verifyWeiboIdentity,
  poll: async (page) => {
    if (!await hasWeiboSessionCookie(page)) {
      throw new AuthRequiredError('weibo.com', 'Waiting for Weibo SUB / SUBP cookies');
    }
    return verifyWeiboIdentity(page);
  },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Inspect the JSON in the error message to see the actual payload and diagnose the mismatch
  2. Check whether Weibo is rate-limiting or serving a captcha page; slow down and retry later
  3. Re-login to refresh cookies; stale sessions often produce unusual responses
  4. Update the library to a version that understands the new Weibo response shape

Example fix

null
Defensive patterns

Strategy: try-catch

Validate before calling

// detect unclassifiable probe payloads before proceeding
if (result && typeof result === 'object' && !Array.isArray(result) &&
    !['auth','http','exception'].includes(result.kind) && !result.ok) {
  console.error('unrecognized probe payload:', JSON.stringify(result));
}

Type guard

function isRecognizedProbe(r) {
  return r !== null && typeof r === 'object' && !Array.isArray(r) &&
    (['auth','http','exception'].includes(r.kind) || r.ok === true);
}

Try / catch

try {
  identity = await verifyWeiboIdentity(page);
} catch (err) {
  if (/Unexpected Weibo probe/.test(err.message)) {
    console.error(err.message); // JSON payload aids diagnosis
    // back off and retry later, or re-login
  } else throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/c6cc60b63ad75639. Report an issue: GitHub.