{"record":{"id":"21aab79c93bcd5be","repo":"jackwener/OpenCLI","slug":"generate-label-did-not-advance-to-the","errorCode":null,"errorMessage":"文字配图: \"${GENERATE_LABEL}\" did not advance to the 预览图片 step. Debug: /tmp/xhs_publish_generate_debug.png","messagePattern":"文字配图: \"(.+?)\" did not advance to the 预览图片 step\\. Debug: /tmp/xhs_publish_generate_debug\\.png","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/xiaohongshu/publish.js","lineNumber":1076,"sourceCode":"        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    }\n    await page.wait({ time: 2 }); // editor render\n    return appliedStyle;\n}\nasync function inspectPublishSurfaceState(page) {\n    return page.evaluate(`\n    () => {\n      const text = (document.body?.innerText || '').replace(/\\s+/g, ' ').trim();\n      const hasTitleInput = !!Array.from(document.querySelectorAll('input, textarea')).find((el) => {\n        if (!el || el.offsetParent === null) return false;","sourceCodeStart":1058,"sourceCodeEnd":1094,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xiaohongshu/publish.js#L1058-L1094","documentation":"Thrown when clicking GENERATE_LABEL ('生成图片') does not advance the flow to the 预览图片 (preview image) step. `clickGenerate(page)` returned false, indicating the expected preview step was not detected after the click. A debug screenshot is saved to /tmp/xhs_publish_generate_debug.png before throwing.","triggerScenarios":"Running the text-image publish flow: all cards were filled successfully, but after clicking '生成图片' the page did not show the 预览图片 step within the wait timeout.","commonSituations":"Card content invalid or too long causing server-side generation failure with an inline error toast; XHS renamed the step/button text; generation service slow or degraded; anti-bot rate limiting after many publishes; a required card style not yet selected.","solutions":["Inspect /tmp/xhs_publish_generate_debug.png for error toasts or a changed page layout","Retry — image generation can be slow; increase the wait before declaring failure","Verify the '生成图片' button text still matches GENERATE_LABEL in clis/xiaohongshu/publish.js and update it if XHS changed the label","Shorten card text / remove problematic characters that may fail server-side rendering","Check XHS creator center status (service outage or captcha/rate-limit)"],"exampleFix":"// before\nconst generated = await clickGenerate(page);\nif (!generated) { ... throw ... }\n// after\nconst generated = await clickGenerate(page);\nif (!generated) {\n  await page.wait({ time: 5 });\n  generated = await clickGenerate(page);\n}\nif (!generated) { ... throw ... }","handlingStrategy":"retry","validationCode":"// pre-check card text length/content sanity before invoking\nconst okCards = cards.every(c => c.length > 0 && c.length < 500);\nif (!okCards) throw new Error('card text out of safe range for generation');","typeGuard":null,"tryCatchPattern":"try {\n  await publish(page, opts);\n} catch (e) {\n  if (String(e.message).includes('did not advance to the 预览图片 step')) {\n    // inspect /tmp/xhs_publish_generate_debug.png, wait longer, retry once\n  }\n  throw e;\n}","preventionTips":["Avoid characters in cards that may break server-side image generation","Increase wait time before declaring the generate step failed","Verify GENERATE_LABEL matches the live XHS button text after UI updates","Watch for rate limiting after repeated publishes"],"tags":["puppeteer","ui-automation","xiaohongshu","timeout"],"backgroundTag":"automation-step-did-not-advance","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}