{"record":{"id":"6d19976c99a11968","repo":"jackwener/OpenCLI","slug":"still-on-the-video-publish-page-after-trying-to-se","errorCode":null,"errorMessage":"Still on the video publish page after trying to select 图文. Details: ${detail}. Debug screenshot: /tmp/xhs_publish_tab_debug.png","messagePattern":"Still on the video publish page after trying to select 图文\\. Details: (.+?)\\. Debug screenshot: /tmp/xhs_publish_tab_debug\\.png","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"clis/xiaohongshu/publish.js","lineNumber":1231,"sourceCode":"        const absImagePaths = validateImagePaths(imagePaths);\n        // ── Step 1: Navigate to publish page ──────────────────────────────────────\n        await page.goto(PUBLISH_URL);\n        await page.wait({ time: 3 });\n        // Verify we landed on the creator site (not redirected to login)\n        const pageUrl = await page.evaluate('() => location.href');\n        if (!pageUrl.includes('creator.xiaohongshu.com')) {\n            throw new Error('Redirected away from creator center — session may have expired. ' +\n                'Re-capture browser login via: opencli xiaohongshu creator-profile');\n        }\n        // ── Step 2: Select 图文 (image+text) note type if tabs are present ─────────\n        const tabResult = await selectImageTextTab(page);\n        const surface = await waitForPublishSurfaceState(page, tabResult?.ok ? 5_000 : 2_000);\n        if (surface.state === 'video_surface') {\n            await page.screenshot({ path: '/tmp/xhs_publish_tab_debug.png' });\n            const detail = tabResult?.ok\n                ? `clicked \"${tabResult.text}\"`\n                : `visible candidates: ${(tabResult?.visibleTexts || []).join(' | ') || 'none'}`;\n            throw new Error('Still on the video publish page after trying to select 图文. ' +\n                `Details: ${detail}. Debug screenshot: /tmp/xhs_publish_tab_debug.png`);\n        }\n        // ── Step 3: Acquire images — text-image generation and/or upload ──────────\n        let appliedCardStyle = cardStyle;\n        if (isTextImage) {\n            // Drive 文字配图: type cards → 生成图片 → pick style → 下一步 → standard editor.\n            appliedCardStyle = await runTextImageFlow(page, cards, cardStyle);\n        }\n        else {\n            const upload = await uploadImages(page, absImagePaths);\n            if (!upload.ok) {\n                await page.screenshot({ path: '/tmp/xhs_publish_upload_debug.png' });\n                throw new CommandExecutionError(`Image injection failed: ${upload.error ?? 'unknown'}. ` +\n                    'Debug screenshot: /tmp/xhs_publish_upload_debug.png');\n            }\n            await page.wait({ time: UPLOAD_SETTLE_MS / 1_000 });\n            await waitForUploads(page);\n        }","sourceCodeStart":1213,"sourceCodeEnd":1249,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xiaohongshu/publish.js#L1213-L1249","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect /tmp/xhs_publish_tab_debug.png to see the actual page state.","Retry once — slow rendering can exceed the wait window.","Re-capture login via 'opencli xiaohongshu creator-profile' in case a variant page requires a fresh session.","Update the CLI or file an issue: the tab selector likely needs adjusting for a new xiaohongshu page layout."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await publish(opts);\n} catch (e) {\n  if (String(e.message).includes('Still on the video publish page')) {\n    // inspect /tmp/xhs_publish_tab_debug.png, wait, then retry once\n    await sleep(5000);\n    return publish(opts);\n  }\n  throw e;\n}","preventionTips":["Keep the CLI updated against xiaohongshu publish-page DOM changes.","Avoid running publish immediately after opening the browser; allow page load time.","Check /tmp/xhs_publish_tab_debug.png whenever this fires before escalating.","Report persistent occurrences — it usually means a selector needs updating."],"tags":["dom-structure","browser-automation","selector-drift","xiaohongshu"],"backgroundTag":"page-layout-changed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}