jackwener/OpenCLI · error · CommandExecutionError

Not logged into Weibo. Please login at weibo.com in your Chr

Error message

Not logged into Weibo. Please login at weibo.com in your Chrome browser.

What it means

After loading weibo.com, the CLI calls getSelfUid(page) to verify login. If that fails with anything other than AuthRequiredError, it assumes the session is logged out and throws this CommandExecutionError directing you to log in at weibo.com in the controlled Chrome browser.

Source

Thrown at clis/weibo/publish.js:110

        },
    ],
    columns: ['status', 'message', 'text'],
    func: async (page, kwargs) => {
        if (!page) throw new CommandExecutionError('Browser session required for weibo publish');

        const text = validateText(kwargs.text);
        const absPaths = validateImagePaths(kwargs.images);

        // Step 1: Navigate to weibo.com and wait for feed to load
        await page.goto('https://weibo.com', { waitUntil: 'load', settleMs: 2000 });
        await page.wait({ time: 2 });

        // Step 2: Check login
        try {
            await getSelfUid(page);
        } catch (err) {
            if (err instanceof AuthRequiredError) throw err;
            throw new CommandExecutionError('Not logged into Weibo. Please login at weibo.com in your Chrome browser.');
        }

        // Step 3: Click "发微博" button to open inline compose editor
        const clickResult = await page.evaluate(`
            () => {
                const visible = el => !!el && el.offsetParent !== null && !el.disabled;
                const buttons = document.querySelectorAll('button[title="发微博"], button[title="写微博"]');
                for (const btn of buttons) {
                    if (visible(btn)) {
                        btn.click();
                        return { ok: true };
                    }
                }
                return { ok: false, message: 'Could not find 发微博 button' };
            }
        `);
        if (!clickResult?.ok) {
            throw new CommandExecutionError(clickResult?.message ?? 'Could not open compose editor.');

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Open weibo.com in the controlled Chrome browser and log in manually, then re-run
  2. Persist cookies in the Chrome profile used by the session
  3. Re-run after clearing captcha/login-wall; if it persists, check whether Weibo changed its identity API

Example fix

// before
weibo publish --text "hi"   # logged-out profile
// after
# 1) open weibo.com in the managed Chrome, log in
# 2) then:
weibo publish --text "hi"
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-flight: verify login by fetching identity as the CLI does
try { await getSelfUid(page); } catch { throw new Error('log in at weibo.com first'); }

Try / catch

try {
  await cli.run(['weibo', 'publish', '--text', text]);
} catch (err) {
  if (/Not logged into Weibo/.test(err.message)) {
    console.error('Open weibo.com in the managed Chrome and log in, then retry');
  } else throw err;
}

Prevention

When it happens

Trigger: Running publish while the Chrome profile has no Weibo session; cookies expired or cleared; weibo.com returning an unexpected page (captcha, redirect) that makes getSelfUid fail.

Common situations: Long-lived automation profiles whose Weibo cookies expired; incognito/fresh profiles; corporate proxies or regions triggering login walls/captchas.

Related errors


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