jackwener/OpenCLI · error · Error

Still on the video publish page after trying to select 图文. D

Error message

Still on the video publish page after trying to select 图文. Details: ${detail}. Debug screenshot: /tmp/xhs_publish_tab_debug.png

What it means

After navigating to the publish page, the CLI tries to click the 图文 (image+text) tab. If the page still reports state 'video_surface' (the video upload form), it means the image-note tab could not be selected and the wrong composer is showing, so publishing images would fail.

Source

Thrown at clis/xiaohongshu/publish.js:1231

        const absImagePaths = validateImagePaths(imagePaths);
        // ── Step 1: Navigate to publish page ──────────────────────────────────────
        await page.goto(PUBLISH_URL);
        await page.wait({ time: 3 });
        // Verify we landed on the creator site (not redirected to login)
        const pageUrl = await page.evaluate('() => location.href');
        if (!pageUrl.includes('creator.xiaohongshu.com')) {
            throw new Error('Redirected away from creator center — session may have expired. ' +
                'Re-capture browser login via: opencli xiaohongshu creator-profile');
        }
        // ── Step 2: Select 图文 (image+text) note type if tabs are present ─────────
        const tabResult = await selectImageTextTab(page);
        const surface = await waitForPublishSurfaceState(page, tabResult?.ok ? 5_000 : 2_000);
        if (surface.state === 'video_surface') {
            await page.screenshot({ path: '/tmp/xhs_publish_tab_debug.png' });
            const detail = tabResult?.ok
                ? `clicked "${tabResult.text}"`
                : `visible candidates: ${(tabResult?.visibleTexts || []).join(' | ') || 'none'}`;
            throw new Error('Still on the video publish page after trying to select 图文. ' +
                `Details: ${detail}. Debug screenshot: /tmp/xhs_publish_tab_debug.png`);
        }
        // ── Step 3: Acquire images — text-image generation and/or upload ──────────
        let appliedCardStyle = cardStyle;
        if (isTextImage) {
            // Drive 文字配图: type cards → 生成图片 → pick style → 下一步 → standard editor.
            appliedCardStyle = await runTextImageFlow(page, cards, cardStyle);
        }
        else {
            const upload = await uploadImages(page, absImagePaths);
            if (!upload.ok) {
                await page.screenshot({ path: '/tmp/xhs_publish_upload_debug.png' });
                throw new CommandExecutionError(`Image injection failed: ${upload.error ?? 'unknown'}. ` +
                    'Debug screenshot: /tmp/xhs_publish_upload_debug.png');
            }
            await page.wait({ time: UPLOAD_SETTLE_MS / 1_000 });
            await waitForUploads(page);
        }

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Inspect /tmp/xhs_publish_tab_debug.png to see the actual page state.
  2. Retry once — slow rendering can exceed the wait window.
  3. Re-capture login via 'opencli xiaohongshu creator-profile' in case a variant page requires a fresh session.
  4. Update the CLI or file an issue: the tab selector likely needs adjusting for a new xiaohongshu page layout.
Defensive patterns

Strategy: retry

Try / catch

try {
  await publish(opts);
} catch (e) {
  if (String(e.message).includes('Still on the video publish page')) {
    // inspect /tmp/xhs_publish_tab_debug.png, wait, then retry once
    await sleep(5000);
    return publish(opts);
  }
  throw e;
}

Prevention

When it happens

Trigger: waitForPublishSurfaceState returns state 'video_surface' even after selectImageTextTab either clicked a candidate tab (tabResult.ok) or found visible candidates — i.e. the tab click did not switch the composer.

Common situations: Xiaohongshu changed the publish page DOM so the tab selectors/text no longer match, a slow page left the composer in default video mode past the 5s/2s waits, or an A/B variant renders the tab differently.

Related errors


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