jackwener/OpenCLI · error · CommandExecutionError

HTTP ${result.httpStatus} from /ajax/profile/info

Error message

HTTP ${result.httpStatus} from /ajax/profile/info

What it means

When the identity probe's fetch of weibo.com /ajax/profile/info returns a non-success HTTP status, the code throws CommandExecutionError(`HTTP ${result.httpStatus} from /ajax/profile/info`). This indicates a transport-level problem (not an auth payload) when validating the logged-in identity.

Source

Thrown at clis/weibo/auth.js:48

      return { kind: 'exception', detail: String(e && e.message || e) };
    }
  })()`;
}

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)) {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry after a delay — 429/5xx are often transient
  2. Check the status code: 403 suggests WAF/anti-bot, 429 suggests rate limiting — slow down request frequency
  3. Ensure the probe fetch includes proper headers (referer, xsrf token) matching current site requirements
  4. Verify the endpoint path /ajax/profile/info is still correct; update if Weibo changed the API
  5. Fall back to an alternate identity source (e.g. page DOM whoami) if the API keeps failing

Example fix

// before
if (result?.kind === 'http') throw new CommandExecutionError(`HTTP ${result.httpStatus} from /ajax/profile/info`);
// after
if (result?.kind === 'http') {
  if (result.httpStatus === 429 || result.httpStatus >= 500) {
    await page.wait(5);
    result = unwrapEvaluateResult(await page.evaluate(buildWeiboIdentityProbe(uid)));
  }
  if (result?.kind === 'http') throw new CommandExecutionError(`HTTP ${result.httpStatus} from /ajax/profile/info`);
}
Defensive patterns

Strategy: retry

Validate before calling

// pre-flight status check
const status = await page.evaluate(() => fetch('/ajax/profile/info', { credentials: 'include' }).then(r => r.status));
if (status !== 200) console.warn(`/ajax/profile/info returned ${status} — expect retries or failure`);

Try / catch

try {
  await verifyWeiboIdentity(page);
} catch (e) {
  const m = /HTTP (\d+) from \/ajax\/profile\/info/.exec(e.message);
  if (m) {
    const code = Number(m[1]);
    if (code === 429 || code >= 500) {
      await sleep(5000); // then retry once
    } else {
      console.error(`Profile API returned ${code}; check headers/endpoint/anti-bot measures.`);
    }
  } else throw e;
}

Prevention

When it happens

Trigger: result.kind === 'http' from the probe: /ajax/profile/info responded 4xx/5xx, e.g. 403 from anti-scraping, 429 rate limit, 5xx server error.

Common situations: Weibo rate-limiting rapid automated probes; anti-crawler WAF returning 403/418; transient server 5xx; missing referer/headers on the in-page fetch after a site update.

Related errors


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