xpzouying/xiaohongshu-mcp · warning
查找旧版发布按钮失败
Error message
查找旧版发布按钮失败
What it means
findPublishButton wraps failures from page.Elements(".publish-page-publish-btn button.bg-red") — the legacy publish button selector — with this message. This fallback only runs when no new-style widget was found; the query failing means the old-version button could not even be searched.
Source
Thrown at xiaohongshu/publish.go:513
}
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 {
return nil, "", errors.Wrap(err, "查找旧版发布按钮失败")
}
for _, oldButton := range oldButtons {
if !isElementVisible(oldButton) {
continue
}
if disabled, err := oldButton.Attribute("disabled"); err != nil {
return nil, "", errors.Wrap(err, "读取旧版发布按钮 disabled 属性失败")
} else if disabled != nil {
return &publishButton{elem: oldButton}, "旧版发布按钮 disabled", nil
}
if ariaDisabled, err := oldButton.Attribute("aria-disabled"); err != nil {
return nil, "", errors.Wrap(err, "读取旧版发布按钮 aria-disabled 属性失败")
} else if ariaDisabled != nil && *ariaDisabled == "true" {
return &publishButton{elem: oldButton}, "旧版发布按钮 aria-disabled=true", nil
}View on GitHub (pinned to 332d196854)
Solutions
- If it propagates (it normally is retried by the polling loop), retry the publish
- Confirm the publish page actually loaded (check URL /publish/publish)
- Check the browser tab is alive and not crashed
- Update the library if Xiaohongshu removed the legacy button markup
Defensive patterns
Strategy: retry
Validate before calling
// 确认发布页已加载
if !strings.Contains(pageMustInfo(page).URL, "/publish/publish") {
return errors.New("尚未进入小红书发布页")
} Try / catch
err := xhs.Publish(...)
if err != nil && strings.Contains(err.Error(), "查找旧版发布按钮失败") {
err = xhs.Publish(...) // 轮询内部会自动重试;此处兜底
} Prevention
- Wait for the publish page to fully load before publishing
- Keep the tab open and browser stable
- Rely on internal polling; only retry if the error escapes
- Update the library if the legacy selector disappears from the platform
When it happens
Trigger: The CSS-selector query against the browser errors: page crashed or navigating, execution context destroyed, or the tab closed while probing the legacy selector.
Common situations: Publishing on a Xiaohongshu page version where neither button style is present; page reload mid-probe; browser instability.
Related errors
AI-assisted analysis of xpzouying/xiaohongshu-mcp@332d196854 (2026-09-05).
Data as JSON: /api/errors/008c6e372197b96b.
Report an issue: GitHub.