jackwener/OpenCLI · error · CommandExecutionError

Jike identity probe failed: ${probe.detail}

Error message

Jike identity probe failed: ${probe.detail}

What it means

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.

Source

Thrown at clis/jike/utils.js:32

    const r = await fetch('https://api.ruguoapp.com/1.0/users/profile', {
      headers: { 'x-jike-access-token': token, Accept: 'application/json' },
    });
    if (r.status === 401 || r.status === 403) return { kind: 'auth', detail: 'Jike users/profile HTTP ' + r.status };
    if (!r.ok) return { kind: 'http', httpStatus: r.status };
    const d = await r.json();
    const u = d && d.user;
    if (!u || !u.id) return { kind: 'auth', detail: 'Jike users/profile returned no user (anonymous)' };
    return { ok: true, user_id: String(u.id), screen_name: String(u.screenName || ''), username: String(u.username || '') };
  } catch (e) {
    return { kind: 'exception', detail: String(e && e.message || e) };
  }
})()`;

export async function requireJikeIdentity(page) {
  const probe = await page.evaluate(JIKE_IDENTITY_PROBE);
  if (probe?.kind === 'auth') throw new AuthRequiredError('web.okjike.com', probe.detail);
  if (probe?.kind === 'http') throw new CommandExecutionError(`HTTP ${probe.httpStatus} from Jike users/profile`);
  if (probe?.kind === 'exception') throw new CommandExecutionError(`Jike identity probe failed: ${probe.detail}`);
  if (!probe?.ok) throw new CommandExecutionError(`Unexpected Jike identity probe: ${JSON.stringify(probe)}`);
  return { user_id: probe.user_id, screen_name: probe.screen_name, username: probe.username };
}

export function normalizeJikeLimit(raw, defaultValue = 20) {
  const limit = raw ?? defaultValue;
  if (!Number.isInteger(limit) || limit < 1) {
    throw new ArgumentError('--limit must be a positive integer');
  }
  return limit;
}

export async function postJikeApi(page, path, requestBody, label) {
  const url = `https://api.ruguoapp.com${path}`;
  const outcome = await page.evaluate(`(async () => {
    const token = localStorage.getItem('JK_ACCESS_TOKEN') || '';
    const deviceId = localStorage.getItem('JK_DEVICE_ID') || '';
    if (!token) return { kind: 'auth', detail: 'Jike access token is missing' };

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Read the interpolated detail message for the underlying cause
  2. Enable cookies/site data for web.okjike.com in the driven browser
  3. Wait for the page to fully load before running identity verification
  4. Check network/proxy settings that could block api.ruguoapp.com
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const identity = await verifyJikeIdentity(page);
} catch (e) {
  if (String(e.message).startsWith('Jike identity probe failed')) {
    console.error('Probe exception:', e.message);
    // fix browser/network config, then retry
  } else throw e;
}

Prevention

When it happens

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

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

Related errors


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