jackwener/OpenCLI · warning · AuthRequiredError

huggingface.co

Error message

huggingface.co

What it means

The hf login poll throws AuthRequiredError('huggingface.co', 'Waiting for Hugging Face login') while the login flow is polling: the whoami probe does not yet report a logged-in session. It signals that the user has not completed login in the browser window (or the session was lost).

Source

Thrown at clis/hf/auth.js:38

  await page.goto('https://huggingface.co/');
  await page.wait(1);
  const probe = await page.evaluate(WHOAMI_PROBE);
  if (probe?.kind === 'auth') throw new AuthRequiredError('huggingface.co', probe.detail);
  if (probe?.kind === 'http') throw new CommandExecutionError(`HTTP ${probe.httpStatus} from HF /api/whoami-v2`);
  if (probe?.kind === 'exception') throw new CommandExecutionError(`HF whoami failed: ${probe.detail}`);
  if (!probe?.ok) throw new CommandExecutionError(`Unexpected HF probe: ${JSON.stringify(probe)}`);
  return { username: probe.username, fullname: probe.fullname, type: probe.type };
}

registerSiteAuthCommands({
  site: 'hf',
  domain: 'huggingface.co',
  loginUrl: 'https://huggingface.co/login',
  columns: ['username', 'fullname', 'type'],
  verify: verifyHfIdentity,
  poll: async (page) => {
    const probe = await page.evaluate(WHOAMI_PROBE);
    if (!probe?.ok) throw new AuthRequiredError('huggingface.co', 'Waiting for Hugging Face login');
    return { username: probe.username, fullname: probe.fullname, type: probe.type };
  },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Complete the login in the opened browser window at huggingface.co/login
  2. Re-run the hf auth login command and finish login before the poll expires
  3. Check that cookies are enabled and no extension clears them
  4. Verify an existing session at huggingface.co; if logged out, log in first

Example fix

// before
poll: page => ... // throws while not logged in
// after
// user completes login at https://huggingface.co/login before poll timeout, then poll returns identity
Defensive patterns

Strategy: try-catch

Validate before calling

const loggedIn = await page.evaluate(() => document.cookie.includes('token') || !!document.querySelector('[data-testid="profile"]'));
if (!loggedIn) console.warn('Complete HF login before running commands');

Type guard

function isLoggedIn(probe) { return !!probe && probe.ok === true && typeof probe.username === 'string'; }

Try / catch

try { identity = await poll(page); } catch (e) { if (e instanceof AuthRequiredError) { console.error('Please log in at https://huggingface.co/login and retry'); } else throw e; }

Prevention

When it happens

Trigger: During the hf auth login poll, WHOAMI_PROBE returns probe.ok falsy — user hasn't finished logging in at huggingface.co/login, or the session cookie expired/cleared mid-poll.

Common situations: User closed the browser before completing login; login timed out; HF session invalid (logged out elsewhere); cookies blocked by browser settings.

Related errors


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