{"record":{"id":"e3571d6d8ed3af72","repo":"xpzouying/xiaohongshu-mcp","slug":"is-publish","errorCode":null,"errorMessage":"读取新版发布按钮 is-publish 属性失败","messagePattern":"读取新版发布按钮 is-publish 属性失败","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"xiaohongshu/publish.go","lineNumber":494,"sourceCode":"\t\treturn nil, errors.Errorf(\"等待发布按钮可点击超时: %s\", lastDisabledReason)\n\t}\n\treturn nil, errors.New(\"等待发布按钮可点击超时\")\n}\n\nfunc findPublishButton(page *rod.Page) (*publishButton, string, error) {\n\twidgets, err := page.Elements(\"xhs-publish-btn\")\n\tif err != nil {\n\t\treturn nil, \"\", errors.Wrap(err, \"查找新版发布按钮失败\")\n\t}\n\n\tfor _, widget := range widgets {\n\t\tif !isElementVisible(widget) {\n\t\t\tcontinue\n\t\t}\n\n\t\tisPublish, err := widget.Attribute(\"is-publish\")\n\t\tif err != nil {\n\t\t\treturn nil, \"\", errors.Wrap(err, \"读取新版发布按钮 is-publish 属性失败\")\n\t\t}\n\t\tif isPublish != nil && *isPublish == \"false\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tsubmitDisabled, err := widget.Attribute(\"submit-disabled\")\n\t\tif err != nil {\n\t\t\treturn nil, \"\", errors.Wrap(err, \"读取新版发布按钮 submit-disabled 属性失败\")\n\t\t}\n\t\tif submitDisabled != nil && *submitDisabled == \"true\" {\n\t\t\treturn &publishButton{elem: widget, isWidget: true}, \"新版发布按钮不可点击\", nil\n\t\t}\n\n\t\treturn &publishButton{elem: widget, isWidget: true}, \"\", nil\n\t}\n\n\toldButtons, err := page.Elements(\".publish-page-publish-btn button.bg-red\")\n\tif err != nil {","sourceCodeStart":476,"sourceCodeEnd":512,"githubUrl":"https://github.com/xpzouying/xiaohongshu-mcp/blob/332d196854a9eac0d2b8c2c0e3d0cc43139d724c/xiaohongshu/publish.go#L476-L512","documentation":"findPublishButton wraps failures from reading the widget's is-publish attribute with this message. The custom element exists but rod's Attribute call (a browser round-trip) failed, so the library cannot decide whether this widget is a publish button.","triggerScenarios":"widget.Attribute(\"is-publish\") errors: element detached during SPA re-render, execution context destroyed, or browser connection issue mid-attribute-read.","commonSituations":"React/Vue re-render replacing the node between Elements() and Attribute(); page navigating; flaky browser connection under heavy load.","solutions":["Transient — waitForPublishButtonClickable logs a warning and keeps polling; retry the publish if it propagates","Avoid heavy parallel page operations that trigger re-renders during publish","Check browser stability (memory/CPU) if it recurs","Update library/rod if the widget API changed"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := xhs.Publish(...)\nif err != nil && strings.Contains(err.Error(), \"is-publish 属性失败\") {\n    err = xhs.Publish(...) // 内部轮询通常已消化该瞬时错误\n}","preventionTips":["Minimize concurrent DOM mutations during publish","Don't navigate away while the button is being probed","Keep browser resources adequate","Update library if failures become persistent"],"tags":["browser-automation","rod","element-attribute"],"backgroundTag":"element-attribute-read-failed","analyzedSha":"332d196854a9eac0d2b8c2c0e3d0cc43139d724c","analyzedAt":"2026-09-05T22:22:55.988Z","contentChangedAt":"2026-09-05T22:22:55.988Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}