jackwener/OpenCLI · error · CommandExecutionError

Unexpected Jike identity probe: ${JSON.stringify(probe)}

Error message

Unexpected Jike identity probe: ${JSON.stringify(probe)}

What it means

Defensive CommandExecutionError thrown by requireJikeIdentity when the probe result has no recognized 'kind' and probe.ok is falsy — i.e. page.evaluate returned something unexpected (null, undefined, or a malformed object). The probe is serialized into the message for diagnosis.

Source

Thrown at clis/jike/utils.js:33

      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' };
    const headers = {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry the command — null results are often transient races
  2. Ensure the page remains open and idle while the command executes
  3. Check browser automation library versions match what the CLI expects
  4. Report the serialized probe payload in an issue if it reproduces consistently
Defensive patterns

Strategy: retry

Try / catch

try {
  const identity = await verifyJikeIdentity(page);
} catch (e) {
  if (String(e.message).startsWith('Unexpected Jike identity probe')) {
    await sleep(1000);
    return verifyJikeIdentity(page); // transient null/abort — retry
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling requireJikeIdentity when page.evaluate resolves to null (script aborted by navigation/close), returns undefined, or an object without the expected kind/ok fields due to a browser automation layer change.

Common situations: Browser tab closed or navigated during evaluate; Playwright/Puppeteer version mismatch altering evaluate serialization; a race where the command runs before the probe string executes.

Related errors


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