{"record":{"id":"8feed5ccd1228a89","repo":"jackwener/OpenCLI","slug":"card-editor-did-not-appear-after-clickin","errorCode":null,"errorMessage":"文字配图: 写文字 card editor did not appear after clicking \"${TEXT_IMAGE_ENTRY_LABEL}\". Debug: /tmp/xhs_publish_textimage_debug.png","messagePattern":"文字配图: 写文字 card editor did not appear after clicking \"(.+?)\"\\. Debug: /tmp/xhs_publish_textimage_debug\\.png","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/xiaohongshu/publish.js","lineNumber":1059,"sourceCode":"        await page.screenshot({ path: '/tmp/xhs_publish_media_debug.png' });\n        throw new CommandExecutionError(`${label}: expected at least ${expectedCount} visible media item(s), got ${state.count}. ` +\n            'Debug screenshot: /tmp/xhs_publish_media_debug.png');\n    }\n}\n/**\n * Drive the full 文字配图 sub-flow: entry → type cards → 生成图片 → pick style → 下一步.\n * Leaves the page on the standard editor (caller then runs waitForEditForm).\n */\nasync function runTextImageFlow(page, cards, cardStyle) {\n    const entry = await clickByText(page, TEXT_IMAGE_ENTRY_LABEL);\n    if (!entry?.ok) {\n        await page.screenshot({ path: '/tmp/xhs_publish_textimage_debug.png' });\n        throw new CommandExecutionError(`文字配图: could not click \"${TEXT_IMAGE_ENTRY_LABEL}\" entry. ` +\n            'Debug: /tmp/xhs_publish_textimage_debug.png');\n    }\n    if (!(await waitForFirstCard(page))) {\n        await page.screenshot({ path: '/tmp/xhs_publish_textimage_debug.png' });\n        throw new CommandExecutionError(`文字配图: 写文字 card editor did not appear after clicking \"${TEXT_IMAGE_ENTRY_LABEL}\". ` +\n            'Debug: /tmp/xhs_publish_textimage_debug.png');\n    }\n    for (let i = 0; i < cards.length; i++) {\n        if (i > 0) {\n            const added = await addCard(page, i + 1);\n            if (!added) {\n                await page.screenshot({ path: '/tmp/xhs_publish_addcard_debug.png' });\n                throw new CommandExecutionError(`文字配图: new card editor #${i + 1} did not render after \"${ADD_CARD_LABEL}\". ` +\n                    'Debug: /tmp/xhs_publish_addcard_debug.png');\n            }\n        }\n        await fillCard(page, cards[i], i);\n    }\n    const generated = await clickGenerate(page);\n    if (!generated) {\n        await page.screenshot({ path: '/tmp/xhs_publish_generate_debug.png' });\n        throw new CommandExecutionError(`文字配图: \"${GENERATE_LABEL}\" did not advance to the 预览图片 step. ` +\n            'Debug: /tmp/xhs_publish_generate_debug.png');","sourceCodeStart":1041,"sourceCodeEnd":1077,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xiaohongshu/publish.js#L1041-L1077","documentation":"After clicking the 文字配图 entry, runTextImageFlow waits for the first 写文字 card editor to appear via waitForFirstCard. If it never appears, a debug screenshot is saved and this error is thrown — the entry was clicked but the editor never mounted.","triggerScenarios":"waitForFirstCard timed out — entry click landed but XHS didn't open the 写文字 editor (client-side error in XHS, animation/dialog blocking, or the editor renders under different selectors).","commonSituations":"XHS A/B change replaced the card editor markup; a rate-limit or login-expiry dialog appeared instead; very slow network exceeding the waitForFirstCard timeout; the entry click actually opened a different option (text-match collision).","solutions":["Inspect /tmp/xhs_publish_textimage_debug.png to see what appeared instead of the editor.","Retry the flow with longer waits; slow mounts are the most common cause.","Confirm the XHS session is valid (re-login if a login dialog intercepts the flow).","If XHS changed DOM, update waitForFirstCard's selectors to match the current 写文字 editor."],"exampleFix":"// before\nawait runTextImageFlow(page, cards, style);\n// after\ntry {\n  await runTextImageFlow(page, cards, style);\n} catch (e) {\n  if (/card editor did not appear/.test(e.message)) {\n    await page.wait({ time: 3.0 });\n    await runTextImageFlow(page, cards, style);\n  } else throw e;\n}","handlingStrategy":"retry","validationCode":"// confirm the entry was actually opened before waiting for editor\nconst opened = await clickByText(page, TEXT_IMAGE_ENTRY_LABEL);\nif (!opened?.ok) throw new Error('entry not clicked; editor will not appear');","typeGuard":"null","tryCatchPattern":"try { await runTextImageFlow(page, cards, style); }\ncatch (e) {\n  if (/card editor did not appear/.test(e.message)) {\n    await page.wait({ time: 3.0 });\n    await runTextImageFlow(page, cards, style);\n  } else throw e;\n}","preventionTips":["Ensure a valid XHS session (login dialogs block the editor from mounting)","Allow generous timeouts for slow networks","Inspect the debug screenshot to see what rendered instead","Keep waitForFirstCard selectors current with XHS DOM changes"],"tags":["browser-automation","timeout","ui-timing"],"backgroundTag":"editor-did-not-mount","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}