xpzouying/xiaohongshu-mcp · error
回复输入框未出现: %w
Error message
回复输入框未出现: %w
What it means
After clicking reply, Reply expects the inline `textarea.comment-input` to appear inside the notification item. If it does not, the reply editor never opened — the click may have silently failed or the UI structure changed. The library aborts rather than typing into the wrong element.
Source
Thrown at xiaohongshu/notification_reply.go:65
}
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`)
if err != nil {
return nil, fmt.Errorf("未找到发送按钮: %w", err)
}
humanize.Delay(ctx, humanize.BeforeSubmit)
if err := humanize.Click(submit); err != nil {View on GitHub (pinned to 332d196854)
Solutions
- Retry — the editor may need more time to mount; consider a retry with backoff
- Check whether Xiaohongshu renamed the textarea selector and update the library
- Verify the page is fully loaded and the session is active before replying
- Increase rod's element lookup timeout via page.Timeout()
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
- Retry once before failing the whole job
- Keep the library updated for selector changes
- Ensure the page is fully loaded before interactions
When it happens
Trigger: item.Element('textarea.comment-input') fails after a successful reply-button click — editor did not open, opened elsewhere, or selector changed.
Common situations: Xiaohongshu updated the comment editor markup; click landed but animation/layout delayed editor mount beyond rod's default timeout; page partially loaded.
Related errors
AI-assisted analysis of xpzouying/xiaohongshu-mcp@332d196854 (2026-09-05).
Data as JSON: /api/errors/e97df938aa7d6a6a.
Report an issue: GitHub.