xpzouying/xiaohongshu-mcp · error
等待发布按钮可点击超时: %s
Error message
等待发布按钮可点击超时: %s
What it means
waitForPublishButtonClickable polls for up to 15 seconds for a clickable publish button. If the timeout expires, it raises this error including the last known reason the button was disabled (e.g. '新版发布按钮不可点击'), or a generic timeout when no reason was captured.
Source
Thrown at xiaohongshu/publish.go:476
for time.Since(start) < maxWait {
btn, disabledReason, err := findPublishButton(page)
if err != nil {
slog.Warn("查找发布按钮失败,继续等待", "error", err)
time.Sleep(interval)
continue
}
if btn != nil && disabledReason == "" {
return btn, nil
}
if disabledReason != "" {
lastDisabledReason = disabledReason
}
time.Sleep(interval)
}
if lastDisabledReason != "" {
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 属性失败")View on GitHub (pinned to 332d196854)
Solutions
- Complete all required form fields (title, content, cover) before publishing
- Increase the wait budget by pre-waiting for uploads to finish before calling Publish
- Retry; if caused by slow loading, a retry with less load may succeed
- Check the included reason string (after the colon) to identify the specific disabled cause
Example fix
// before // large video still uploading; button stays disabled 15s err := xhs.PublishVideo(...) // 等待发布按钮可点击超时: 新版发布按钮不可点击 // after // wait for upload completion signal before clicking through the library flow waitUploadFinished(page) err := xhs.PublishVideo(...)
Defensive patterns
Strategy: retry
Validate before calling
// 调用前确保表单必填项齐全且上传已完成
if title == "" || content == "" || !uploadFinished {
return errors.New("发布表单未就绪,发布按钮会保持禁用")
} Try / catch
err := xhs.Publish(...)
if err != nil && strings.Contains(err.Error(), "等待发布按钮可点击超时") {
reason := err.Error() // 冒号后为具体禁用原因
// 依据 reason 修复表单后重试
} Prevention
- Fill all required fields (title, content, cover) before publishing
- Wait for media uploads to finish before the publish step
- Parse the reason after the colon to diagnose the disabled cause
- Allow more wall time on slow networks
When it happens
Trigger: The publish form never reaches a state where the button is enabled: required fields (title/content/cover) invalid, the custom widget reports submit-disabled=true persistently, or the button never renders within 15 seconds.
Common situations: Uploading a very large video/image so content isn't ready within 15s; Xiaohongshu marks the submit disabled due to form validation (missing cover, forbidden words); slow network keeping the page in a loading state.
Related errors
AI-assisted analysis of xpzouying/xiaohongshu-mcp@332d196854 (2026-09-05).
Data as JSON: /api/errors/1c5f93db8c1b4f45.
Report an issue: GitHub.