jackwener/OpenCLI · error · CommandExecutionError

Unexpected Upwork probe: ${JSON.stringify(probe)}

Error message

Unexpected Upwork probe: ${JSON.stringify(probe)}

What it means

If the in-page probe returns neither a known failure shape nor ok:true, verifyUpworkIdentity throws CommandExecutionError with the JSON-serialized probe. This guards against unexpected response shapes so silent garbage is never treated as a successful identity verification.

Source

Thrown at clis/upwork/auth.js:36

      if (/\\/(ab|account-security\\/login|signup)\\//.test(location.pathname)) {
        return { kind: 'auth', detail: 'Upwork redirected to login flow' };
      }
      const nuxt = (typeof window !== 'undefined' && window.__NUXT__) ? window.__NUXT__ : null;
      const state = nuxt && (nuxt.state || (nuxt.data && nuxt.data[0]));
      const user = state && (state.user || (state.auth && state.auth.user));
      const profile = user && (user.profile || user);
      if (!profile || !profile.id) {
        return { kind: 'auth', detail: 'Upwork __NUXT__ has no profile id — anonymous' };
      }
      return {
        ok: true,
        user_id: String(profile.id || profile.uid || ''),
        ciphertext: String(profile.ciphertext || ''),
      };
    })()
  `);
  if (probe?.kind === 'auth') throw new AuthRequiredError('upwork.com', probe.detail);
  if (!probe?.ok) throw new CommandExecutionError(`Unexpected Upwork probe: ${JSON.stringify(probe)}`);
  return { user_id: probe.user_id, ciphertext: probe.ciphertext };
}

registerSiteAuthCommands({
  site: 'upwork',
  domain: 'upwork.com',
  loginUrl: 'https://www.upwork.com/ab/account-security/login',
  columns: ['user_id', 'ciphertext'],
  quickCheck: hasUpworkSessionCookie,
  verify: verifyUpworkIdentity,
  poll: async (page) => {
    if (!await hasUpworkSessionCookie(page)) {
      throw new AuthRequiredError('upwork.com', 'Waiting for Upwork session cookies');
    }
    return verifyUpworkIdentity(page);
  },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Navigate the connected browser to https://www.upwork.com/nx/find-work/ and ensure you're logged in, then retry.
  2. Inspect the JSON in the error message — it shows the actual probe result and reveals what went wrong.
  3. Retry after the page fully loads; evaluation during navigation can return undefined.
  4. Update the library if Upwork changed its page structure (profile object shape) — an outdated probe is a common cause.
  5. Re-attach the browser bridge / restart the browser if evaluate consistently returns null.
Defensive patterns

Strategy: type-guard

Validate before calling

await page.goto('https://www.upwork.com/nx/find-work/', { waitUntil: 'networkidle' });
if (page.url().startsWith('about:blank') || !page.url().includes('upwork.com')) throw new Error('Browser not on an Upwork page');

Type guard

function isSuccessfulProbe(p) {
  return !!p && typeof p === 'object' && p.ok === true && typeof p.user_id === 'string';
}

Try / catch

try {
  await verifyUpworkIdentity(page);
} catch (e) {
  if (e instanceof CommandExecutionError && e.message.startsWith('Unexpected Upwork probe')) {
    // inspect e.message JSON, reload the page, retry once
    await page.reload();
    await verifyUpworkIdentity(page);
  } else throw e;
}

Prevention

When it happens

Trigger: page.evaluate returns null/undefined, a non-object (e.g. a string error), or an object without ok:true and without kind:'auth' — e.g. the probe script was altered by page context, ran on the wrong page (blank tab, extension page), or an exception inside the IIFE swallowed the return value.

Common situations: Connected browser sitting on about:blank or a non-Upwork page when the command runs; an extension or CSP blocking inline script evaluation; Upwork DOM/site changes breaking the probe's expected profile object; page navigation cancelling evaluation mid-flight.

Related errors


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