{"record":{"id":"484a787e9dd2f1b8","repo":"xpzouying/xiaohongshu-mcp","slug":"error-484a78","errorCode":null,"errorMessage":"等待商品弹窗失败","messagePattern":"等待商品弹窗失败","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xiaohongshu/publish.go","lineNumber":1142,"sourceCode":"\n// bindProducts 绑定商品到发布内容\nfunc bindProducts(ctx context.Context, page *rod.Page, products []string) error {\n\tif len(products) == 0 {\n\t\treturn nil\n\t}\n\n\tslog.Info(\"开始绑定商品\", \"products\", products)\n\n\t// 点击\"添加商品\"按钮\n\tif err := clickAddProductButton(page); err != nil {\n\t\treturn errors.Wrap(err, \"点击添加商品按钮失败\")\n\t}\n\ttime.Sleep(1 * time.Second)\n\n\t// 等待商品选择弹窗出现\n\tmodal, err := waitForProductModal(page)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"等待商品弹窗失败\")\n\t}\n\tslog.Info(\"商品选择弹窗已打开\")\n\n\t// 遍历搜索并选择商品\n\tvar failedProducts []string\n\tfor _, keyword := range products {\n\t\tif err := searchAndSelectProduct(ctx, page, modal, keyword); err != nil {\n\t\t\tslog.Warn(\"搜索选择商品失败\", \"keyword\", keyword, \"error\", err)\n\t\t\tfailedProducts = append(failedProducts, keyword)\n\t\t}\n\t\ttime.Sleep(500 * time.Millisecond)\n\t}\n\n\t// 点击保存按钮\n\tslog.Info(\"准备点击保存按钮\")\n\tif err := clickModalSaveButton(modal); err != nil {\n\t\treturn errors.Wrap(err, \"点击保存按钮失败\")\n\t}","sourceCodeStart":1124,"sourceCodeEnd":1160,"githubUrl":"https://github.com/xpzouying/xiaohongshu-mcp/blob/332d196854a9eac0d2b8c2c0e3d0cc43139d724c/xiaohongshu/publish.go#L1124-L1160","documentation":"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.","triggerScenarios":"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.","commonSituations":"Slow network on the product listing (modal loads inventory data); click intercepted by an overlay; test environments where the product service is unavailable.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := bindProducts(ctx, page, products); err != nil {\n    if strings.Contains(err.Error(), \"等待商品弹窗失败\") {\n        time.Sleep(2 * time.Second)\n        err = bindProducts(ctx, page, products) // one retry\n    }\n}","preventionTips":["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"],"tags":["go-rod","timeout","modal"],"backgroundTag":"wait-timeout","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"}