{"record":{"id":"d3704be5e334003d","repo":"xpzouying/xiaohongshu-mcp","slug":"error-d3704b","errorCode":null,"errorMessage":"绑定商品失败","messagePattern":"绑定商品失败","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xiaohongshu/publish_video.go","lineNumber":147,"sourceCode":"\n\thumanize.Delay(ctx, humanize.AfterType)\n\n\t// 处理定时发布\n\tif scheduleTime != nil {\n\t\tif err := setSchedulePublish(ctx, page, *scheduleTime); err != nil {\n\t\t\treturn errors.Wrap(err, \"设置定时发布失败\")\n\t\t}\n\t\tslog.Info(\"定时发布设置完成\", \"schedule_time\", scheduleTime.Format(\"2006-01-02 15:04\"))\n\t}\n\n\t// 设置可见范围\n\tif err := setVisibility(page, visibility); err != nil {\n\t\treturn errors.Wrap(err, \"设置可见范围失败\")\n\t}\n\n\t// 绑定商品\n\tif err := bindProducts(ctx, page, products); err != nil {\n\t\treturn errors.Wrap(err, \"绑定商品失败\")\n\t}\n\n\tif err := clickPublishButton(page); err != nil {\n\t\treturn err\n\t}\n\n\t// 校验发布真的成功（成功跳转离开发布页），未跳转判失败——消除假成功\n\treturn waitPublishSuccess(page, 15*time.Second)\n}\n","sourceCodeStart":129,"sourceCodeEnd":157,"githubUrl":"https://github.com/xpzouying/xiaohongshu-mcp/blob/332d196854a9eac0d2b8c2c0e3d0cc43139d724c/xiaohongshu/publish_video.go#L129-L157","documentation":"bindProducts attaches commerce products (by keyword search) to the video. Failure is wrapped as \"绑定商品失败\" — the product-binding UI could not be operated or no matching product was found. Note: this step runs even when Products is an empty slice, depending on bindProducts' internal guard.","triggerScenarios":"bindProducts(ctx, page, products) fails because the 贤物/商品 entry selector changed, product search returned no results for the keywords, the account has no 货架/commerce permission, or an empty-but-non-nil Products slice triggers the binding flow with nothing to select.","commonSituations":"Creator account without e-commerce/带货 authorization; keyword matches no product in the showcase; popup rendered in an iframe; platform A/B testing changed the product panel markup.","solutions":["Verify the account has product-binding (带货) permission in the creator center","Use product keywords that exactly match items in your showcase","Pass nil or an empty Products list if no binding is needed (and confirm bindProducts skips it)","Update the product panel selectors after inspecting current page markup"],"exampleFix":"// before\naction.PublishVideo(ctx, PublishVideoContent{Products: []string{}})\n// after\nvar products []string = nil // skip binding entirely\nif hasProducts { products = []string{\"exact product name\"} }\naction.PublishVideo(ctx, PublishVideoContent{Products: products})","handlingStrategy":"fallback","validationCode":"for _, kw := range products {\n    if strings.TrimSpace(kw) == \"\" {\n        return errors.New(\"empty product keyword\")\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := bindProducts(ctx, page, products); err != nil {\n    if len(products) > 0 {\n        log.Printf(\"product binding failed: %+v — publishing without products\", err)\n    } // non-fatal when binding is optional\n}","preventionTips":["Confirm the account has 带货 authorization before using Products","Use exact showcase product names as keywords","Pass nil (not empty slice) when no binding is intended","Make product binding non-fatal so the publish still succeeds"],"tags":["browser-automation","go","e-commerce","selector"],"backgroundTag":"selector-mismatch","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"}