xpzouying/xiaohongshu-mcp · error
等待商品弹窗失败
Error message
等待商品弹窗失败
What it means
bindProducts wraps a waitForProductModal failure with this message. After clicking '添加商品', the product-selection dialog did not appear within the helper's timeout. The click either didn't register, the dialog failed to open (permissions/loading), or the modal's detection selector changed.
Source
Thrown at xiaohongshu/publish.go:1142
// bindProducts 绑定商品到发布内容
func bindProducts(ctx context.Context, page *rod.Page, products []string) error {
if len(products) == 0 {
return nil
}
slog.Info("开始绑定商品", "products", products)
// 点击"添加商品"按钮
if err := clickAddProductButton(page); err != nil {
return errors.Wrap(err, "点击添加商品按钮失败")
}
time.Sleep(1 * time.Second)
// 等待商品选择弹窗出现
modal, err := waitForProductModal(page)
if err != nil {
return errors.Wrap(err, "等待商品弹窗失败")
}
slog.Info("商品选择弹窗已打开")
// 遍历搜索并选择商品
var failedProducts []string
for _, keyword := range products {
if err := searchAndSelectProduct(ctx, page, modal, keyword); err != nil {
slog.Warn("搜索选择商品失败", "keyword", keyword, "error", err)
failedProducts = append(failedProducts, keyword)
}
time.Sleep(500 * time.Millisecond)
}
// 点击保存按钮
slog.Info("准备点击保存按钮")
if err := clickModalSaveButton(modal); err != nil {
return errors.Wrap(err, "点击保存按钮失败")
}View on GitHub (pinned to 332d196854)
Solutions
- Increase waitForProductModal's timeout or add retries
- Confirm the preceding click succeeded by checking logs for '已点击添加商品按钮'
- Inspect what selector waitForProductModal waits on and update if the DOM changed
- Verify account/merchant permissions for the product picker
Defensive patterns
Strategy: retry
Try / catch
if err := bindProducts(ctx, page, products); err != nil {
if strings.Contains(err.Error(), "等待商品弹窗失败") {
time.Sleep(2 * time.Second)
err = bindProducts(ctx, page, products) // one retry
}
} Prevention
- Raise waitForProductModal timeout for slow networks
- Check the click log line to confirm the button click registered
- Keep the modal selector in sync with the frontend
- Verify merchant permissions so the dialog actually opens
When it happens
Trigger: The add-product click landed but the modal render exceeded waitForProductModal's timeout; account lacks product access so nothing opens; the modal's expected selector changed in a frontend update.
Common situations: Slow network on the product listing (modal loads inventory data); click intercepted by an overlay; test environments where the product service is unavailable.
Related errors
AI-assisted analysis of xpzouying/xiaohongshu-mcp@332d196854 (2026-09-05).
Data as JSON: /api/errors/484a787e9dd2f1b8.
Report an issue: GitHub.