{"record":{"id":"0fbbf9f1a082c038","repo":"jackwener/OpenCLI","slug":"new-card-editor-i-1-did-not-render-aft","errorCode":null,"errorMessage":"文字配图: new card editor #${i + 1} did not render after \"${ADD_CARD_LABEL}\". Debug: /tmp/xhs_publish_addcard_debug.png","messagePattern":"文字配图: new card editor #(.+?) did not render after \"(.+?)\"\\. Debug: /tmp/xhs_publish_addcard_debug\\.png","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/xiaohongshu/publish.js","lineNumber":1067,"sourceCode":" */\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');\n    }\n    const appliedStyle = await selectCardStyle(page, cardStyle);\n    const next = await clickByText(page, PREVIEW_NEXT_LABEL);\n    if (!next?.ok) {\n        await page.screenshot({ path: '/tmp/xhs_publish_next_debug.png' });\n        throw new CommandExecutionError(`文字配图: could not click \"${PREVIEW_NEXT_LABEL}\". ` +\n            'Debug: /tmp/xhs_publish_next_debug.png');\n    }","sourceCodeStart":1049,"sourceCodeEnd":1085,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xiaohongshu/publish.js#L1049-L1085","documentation":"Thrown by the xhs publish CLI's text-image (文字配图) flow when clicking the '再写一张' button fails to produce a new card editor. `addCard(page, i + 1)` returned a falsy result, meaning the expected additional `.tiptap.ProseMirror` editor never appeared within the wait window. A debug screenshot is saved to /tmp/xhs_publish_addcard_debug.png before throwing so the DOM state at failure time can be inspected.","triggerScenarios":"Calling the publish command with --card-text containing 2+ cards, where clicking the ADD_CARD_LABEL ('再写一张') button did not render card editor #i+1 (i.e. the count of .tiptap.ProseMirror editors did not grow).","commonSituations":"Xiaohongshu creator-center UI changed so the '再写一张' button label/position differs; page still loading or an overlay (login wall, guide modal) blocks the button; slow network leaving the card editor animation unfinished; a prior card fill left the editor in an unexpected state.","solutions":["Open /tmp/xhs_publish_addcard_debug.png to see what the page actually showed at failure","Re-run with a longer wait or retry — transient slowness is common","Check whether the '再写一家'/'再写一张' button label changed in the current XHS UI and update ADD_CARD_LABEL in clis/xiaohongshu/publish.js","Verify you are logged in and on the publish editor page (no login redirect or modal overlay)","Reduce card count in --card-text to isolate which card index fails"],"exampleFix":"// before\nconst added = await addCard(page, i + 1);\nif (!added) { ... throw ... }\n// after\nlet added = false;\nfor (let attempt = 0; attempt < 3 && !added; attempt++) {\n  await page.wait({ time: 2 });\n  added = await addCard(page, i + 1);\n}\nif (!added) { ... throw ... }","handlingStrategy":"retry","validationCode":"const cards = cardText.split('|').map(s => s.trim()).filter(Boolean);\nif (cards.length > 1) console.log('will need', cards.length - 1, 'add-card clicks');","typeGuard":null,"tryCatchPattern":"try {\n  await publish(page, opts);\n} catch (e) {\n  if (String(e.message).includes('did not render after')) {\n    await page.screenshot({ path: '/tmp/addcard_retry.png' });\n    // retry once after a longer wait, or fall back to fewer cards\n  }\n  throw e;\n}","preventionTips":["Keep card count low (2-3) to minimize add-card clicks","Ensure a stable login session before publishing","Check /tmp/xhs_publish_addcard_debug.png on every failure and update ADD_CARD_LABEL when XHS renames the button","Add generous waits between card fills"],"tags":["puppeteer","ui-automation","xiaohongshu","selector-mismatch"],"backgroundTag":"automation-step-did-not-render","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}