jackwener/OpenCLI · info · AuthRequiredError('jimeng.jianying.com')

Waiting for Jimeng login

Error message

Waiting for Jimeng login

What it means

During the Jimeng login wait, the poll callback evaluates WHOAMI_PROBE and, while the probe does not report ok (user not yet signed in), throws AuthRequiredError('Waiting for Jimeng login'). This is the expected control-flow signal that the interactive login flow should keep polling until the user completes sign-in.

Source

Thrown at clis/jimeng/auth.js:43

  await page.goto('https://jimeng.jianying.com/ai-tool/generate?type=image&workspace=0');
  await page.wait(2);
  const probe = await page.evaluate(WHOAMI_PROBE);
  if (probe?.kind === 'auth') throw new AuthRequiredError('jimeng.jianying.com', probe.detail);
  if (probe?.kind === 'http') throw new CommandExecutionError(`HTTP ${probe.httpStatus} from Jimeng passport`);
  if (probe?.kind === 'exception') throw new CommandExecutionError(`Jimeng whoami failed: ${probe.detail}`);
  if (!probe?.ok) throw new CommandExecutionError(`Unexpected Jimeng probe: ${JSON.stringify(probe)}`);
  return { user_id: probe.user_id, screen_name: probe.screen_name };
}

registerSiteAuthCommands({
  site: 'jimeng',
  domain: 'jimeng.jianying.com',
  loginUrl: 'https://jimeng.jianying.com/',
  columns: ['user_id', 'screen_name'],
  verify: verifyJimengIdentity,
  poll: async (page) => {
    const probe = await page.evaluate(WHOAMI_PROBE);
    if (!probe?.ok) throw new AuthRequiredError('jimeng.jianying.com', 'Waiting for Jimeng login');
    return { user_id: probe.user_id, screen_name: probe.screen_name };
  },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Complete the sign-in in the attached Chrome window — this error is expected until then
  2. Make sure the active tab is on jimeng.jianying.com so the probe runs in the right page
  3. If you already logged in but it still fails, reload the page so fresh cookies are visible to the probe
  4. Extend the login timeout if sign-in takes long; abort and rerun the login command if the browser was closed
  5. Verify cookies persisted (not incognito/profile mismatch) if repeated logins never succeed

Example fix

// before
await loginFlow.run(); // throws while waiting
// after
try {
  await loginFlow.run();
} catch (err) {
  if (err instanceof AuthRequiredError && err.message === 'Waiting for Jimeng login') {
    console.error('Timed out waiting for Jimeng login — sign in at jimeng.jianying.com and rerun.');
  }
  throw err;
}
Defensive patterns

Strategy: try-catch

Type guard

function isWaitingForLogin(err) {
  return err instanceof AuthRequiredError && err.message === 'Waiting for Jimeng login';
}

Try / catch

try {
  const identity = await loginFlow.wait();
} catch (err) {
  if (!isWaitingForLogin(err)) throw err;
  // expected while polling: keep waiting or abort on timeout
  throw new Error('Jimeng login not completed in time — sign in at jimeng.jianying.com and retry');
}

Prevention

When it happens

Trigger: The registerSiteAuthCommands login/poll loop invokes poll(page) before the user has finished signing in at jimeng.jianying.com — probe.ok is falsy on every poll until login completes.

Common situations: Normal mid-login polling; user closed the browser without signing in (error loops indefinitely); slow manual login exceeding the flow's timeout; probing a tab that isn't on the Jimeng domain.

Related errors


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