xpzouying/xiaohongshu-mcp · warning
未找到添加商品按钮,账号可能未开通商品功能
Error message
未找到添加商品按钮,账号可能未开通商品功能
What it means
bindProducts searches the publish page for the '添加商品' (add product) button and, if absent, throws this error noting the account likely lacks commerce/product functionality. XHS only renders this button for accounts with 商品/带货 permission, so its absence is often a legitimate account capability issue rather than a bug.
Source
Thrown at xiaohongshu/publish.go:1234
slog.Info("已点击添加商品按钮")
time.Sleep(300 * time.Millisecond) // 确保弹窗动画开始
return nil
}
cls, _ := parent.Attribute("class")
if cls != nil && strings.Contains(*cls, "d-button") {
if err := humanize.Click(parent); err != nil {
return errors.Wrap(err, "点击添加商品按钮失败")
}
slog.Info("已点击添加商品按钮")
time.Sleep(300 * time.Millisecond) // 确保弹窗动画开始
return nil
}
}
}
}
return errors.New("未找到添加商品按钮,账号可能未开通商品功能")
}
// waitForProductModal 等待商品选择弹窗出现
func waitForProductModal(page *rod.Page) (*rod.Element, error) {
deadline := time.Now().Add(10 * time.Second)
for time.Now().Before(deadline) {
modal, err := page.Element(".multi-goods-selector-modal")
if err == nil && modal != nil {
visible, _ := modal.Visible()
if visible {
slog.Info("商品选择弹窗已出现")
return modal, nil
}
}
time.Sleep(100 * time.Millisecond) // 缩短轮询间隔,更快响应
}
View on GitHub (pinned to 332d196854)
Solutions
- Verify the account has 商品/带货 permission in 小红书创作者中心 and enable it if not — most common cause
- Treat this as a soft failure in the caller: skip product binding and continue publishing when the feature isn't provisioned
- Confirm the note type supports products (some note types hide the entry)
- Check whether the entry now lives under a collapsed section/expander and open it before searching
Example fix
// before
return errors.New("未找到添加商品按钮,账号可能未开通商品功能")
// after
return errors.New("未找到添加商品按钮,账号可能未开通商品功能") // caller:
if err := bindProducts(page, products); err != nil {
slog.Warn("绑定商品失败,继续发布", "error", err)
} Defensive patterns
Strategy: fallback
Try / catch
if err := bindProducts(page, products); err != nil {
if strings.Contains(err.Error(), "未找到添加商品按钮") {
slog.Warn("账号未开通商品功能,跳过商品绑定")
return nil // 继续发布,不绑定商品
}
return err
} Prevention
- Check the account has 商品/带货 permission in 创作者中心 before attempting binding
- Make product binding optional in your publish pipeline — degrade gracefully when absent
- Confirm the note type supports product association
- Pre-check for the button's existence before collecting product data to avoid wasted work
When it happens
Trigger: bindProducts → clickAddProductButton; the button selector matched nothing within its search window — account has no product feature enabled, the entry is collapsed under another tab/panel, or the page section hasn't rendered yet.
Common situations: Personal/unprovisioned accounts without 带货权限; enterprise account needing to enable product listing in creator center; the add-product entry only appears for video/note types that support products; XHS moving the entry into a different menu.
Related errors
AI-assisted analysis of xpzouying/xiaohongshu-mcp@332d196854 (2026-09-05).
Data as JSON: /api/errors/3be94875a62a0b2c.
Report an issue: GitHub.