xpzouying/xiaohongshu-mcp · error
无法点击回复: %w
Error message
无法点击回复: %w
What it means
humanize.Click failed to click the reply button, e.g. because the element is not clickable (covered by another element, detached from DOM, or intercepted by an overlay/login popup). The error wraps the underlying humanize/rod failure.
Source
Thrown at xiaohongshu/notification_reply.go:59
items, err := page.Elements(`.tabs-content-container > .container`)
if err != nil {
return nil, fmt.Errorf("未找到通知条目: %w", err)
}
if index >= len(items) {
return nil, fmt.Errorf("通知条目渲染数(%d)少于目标位置(%d),页面可能未加载完", len(items), index)
}
item := items[index]
humanize.Delay(ctx, humanize.Reading)
replyBtn, err := item.Element(`.action-reply`)
if err != nil {
return nil, fmt.Errorf("该通知没有回复入口(评论可能已删除或不可回复): %w", err)
}
humanize.Delay(ctx, humanize.BeforeClick)
if err := humanize.Click(replyBtn); err != nil {
return nil, fmt.Errorf("无法点击回复: %w", err)
}
humanize.Delay(ctx, humanize.AfterClick)
input, err := item.Element(`textarea.comment-input`)
if err != nil {
return nil, fmt.Errorf("回复输入框未出现: %w", err)
}
if err := verifyReplyTarget(input, target.from().Nickname); err != nil {
return nil, err
}
if err := humanize.Type(ctx, input, content); err != nil {
return nil, fmt.Errorf("无法输入回复内容: %w", err)
}
humanize.Delay(ctx, humanize.AfterType)
submit, err := item.Element(`button.submit`)View on GitHub (pinned to 332d196854)
Solutions
- Retry the call — transient overlay or re-render often resolves on retry
- Ensure no login wall/modal is blocking the page (valid session cookies)
- Close competing browser tabs/popups using the same profile
- Update go-rod/humanize in case of known click race fixes
Defensive patterns
Strategy: retry
Try / catch
_, err := n.Reply(ctx, commentID, content)
if err != nil && strings.Contains(err.Error(), "无法点击回复") {
time.Sleep(2 * time.Second)
_, err = n.Reply(ctx, commentID, content)
} Prevention
- Keep a valid session so no login modal blocks clicks
- Space out interactions to avoid anti-bot overlays
- Retry transient click failures with backoff
When it happens
Trigger: humanize.Click(replyBtn) returns an error during Reply — element detached after re-render, obscured by modal, or page navigated between lookup and click.
Common situations: Popup or login dialog intercepting clicks; DOM re-render invalidated the element handle; anti-bot overlay present; slow machine widened the race window.
Related errors
AI-assisted analysis of xpzouying/xiaohongshu-mcp@332d196854 (2026-09-05).
Data as JSON: /api/errors/43650c4a7f0a7095.
Report an issue: GitHub.