xpzouying/xiaohongshu-mcp · warning
读取新版发布按钮 is-publish 属性失败
Error message
读取新版发布按钮 is-publish 属性失败
What it means
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.
Source
Thrown at xiaohongshu/publish.go:494
return nil, errors.Errorf("等待发布按钮可点击超时: %s", lastDisabledReason)
}
return nil, errors.New("等待发布按钮可点击超时")
}
func findPublishButton(page *rod.Page) (*publishButton, string, error) {
widgets, err := page.Elements("xhs-publish-btn")
if err != nil {
return nil, "", errors.Wrap(err, "查找新版发布按钮失败")
}
for _, widget := range widgets {
if !isElementVisible(widget) {
continue
}
isPublish, err := widget.Attribute("is-publish")
if err != nil {
return nil, "", errors.Wrap(err, "读取新版发布按钮 is-publish 属性失败")
}
if isPublish != nil && *isPublish == "false" {
continue
}
submitDisabled, err := widget.Attribute("submit-disabled")
if err != nil {
return nil, "", errors.Wrap(err, "读取新版发布按钮 submit-disabled 属性失败")
}
if submitDisabled != nil && *submitDisabled == "true" {
return &publishButton{elem: widget, isWidget: true}, "新版发布按钮不可点击", nil
}
return &publishButton{elem: widget, isWidget: true}, "", nil
}
oldButtons, err := page.Elements(".publish-page-publish-btn button.bg-red")
if err != nil {View on GitHub (pinned to 332d196854)
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
Defensive patterns
Strategy: retry
Try / catch
err := xhs.Publish(...)
if err != nil && strings.Contains(err.Error(), "is-publish 属性失败") {
err = xhs.Publish(...) // 内部轮询通常已消化该瞬时错误
} Prevention
- 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
When it happens
Trigger: widget.Attribute("is-publish") errors: element detached during SPA re-render, execution context destroyed, or browser connection issue mid-attribute-read.
Common situations: React/Vue re-render replacing the node between Elements() and Attribute(); page navigating; flaky browser connection under heavy load.
Related errors
AI-assisted analysis of xpzouying/xiaohongshu-mcp@332d196854 (2026-09-05).
Data as JSON: /api/errors/e3571d6d8ed3af72.
Report an issue: GitHub.