{"record":{"id":"3be94875a62a0b2c","repo":"xpzouying/xiaohongshu-mcp","slug":"error-3be948","errorCode":null,"errorMessage":"未找到添加商品按钮，账号可能未开通商品功能","messagePattern":"未找到添加商品按钮，账号可能未开通商品功能","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"xiaohongshu/publish.go","lineNumber":1234,"sourceCode":"\t\t\t\t\tslog.Info(\"已点击添加商品按钮\")\n\t\t\t\t\ttime.Sleep(300 * time.Millisecond) // 确保弹窗动画开始\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\n\t\t\t\tcls, _ := parent.Attribute(\"class\")\n\t\t\t\tif cls != nil && strings.Contains(*cls, \"d-button\") {\n\t\t\t\t\tif err := humanize.Click(parent); err != nil {\n\t\t\t\t\t\treturn errors.Wrap(err, \"点击添加商品按钮失败\")\n\t\t\t\t\t}\n\t\t\t\t\tslog.Info(\"已点击添加商品按钮\")\n\t\t\t\t\ttime.Sleep(300 * time.Millisecond) // 确保弹窗动画开始\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn errors.New(\"未找到添加商品按钮，账号可能未开通商品功能\")\n}\n\n// waitForProductModal 等待商品选择弹窗出现\nfunc waitForProductModal(page *rod.Page) (*rod.Element, error) {\n\tdeadline := time.Now().Add(10 * time.Second)\n\n\tfor time.Now().Before(deadline) {\n\t\tmodal, err := page.Element(\".multi-goods-selector-modal\")\n\t\tif err == nil && modal != nil {\n\t\t\tvisible, _ := modal.Visible()\n\t\t\tif visible {\n\t\t\t\tslog.Info(\"商品选择弹窗已出现\")\n\t\t\t\treturn modal, nil\n\t\t\t}\n\t\t}\n\t\ttime.Sleep(100 * time.Millisecond) // 缩短轮询间隔，更快响应\n\t}\n","sourceCodeStart":1216,"sourceCodeEnd":1252,"githubUrl":"https://github.com/xpzouying/xiaohongshu-mcp/blob/332d196854a9eac0d2b8c2c0e3d0cc43139d724c/xiaohongshu/publish.go#L1216-L1252","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nreturn errors.New(\"未找到添加商品按钮，账号可能未开通商品功能\")\n// after\nreturn errors.New(\"未找到添加商品按钮，账号可能未开通商品功能\") // caller:\nif err := bindProducts(page, products); err != nil {\n\tslog.Warn(\"绑定商品失败，继续发布\", \"error\", err)\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := bindProducts(page, products); err != nil {\n\tif strings.Contains(err.Error(), \"未找到添加商品按钮\") {\n\t\tslog.Warn(\"账号未开通商品功能，跳过商品绑定\")\n\t\treturn nil // 继续发布，不绑定商品\n\t}\n\treturn err\n}","preventionTips":["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"],"tags":["account-permission","commerce","dom","xiaohongshu"],"backgroundTag":"feature-button-not-found","analyzedSha":"332d196854a9eac0d2b8c2c0e3d0cc43139d724c","analyzedAt":"2026-09-05T22:22:55.988Z","contentChangedAt":"2026-09-05T22:22:55.988Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}