xpzouying/xiaohongshu-mcp · error

未找到发送按钮: %w

Error message

未找到发送按钮: %w

What it means

After typing the reply, Reply looks for the submit button `button.submit` inside the notification item. If rod cannot find it, the editor rendered without a recognizable send button — usually a UI markup change or the editor state collapsed after typing. The library aborts without submitting a partial reply.

Source

Thrown at xiaohongshu/notification_reply.go:79

	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 {
		return nil, fmt.Errorf("无法点击发送: %w", err)
	}

	if err := waitReplyAccepted(item, 8*time.Second); err != nil {
		return nil, err
	}

	humanize.Delay(ctx, humanize.AfterInteract)

	logrus.Infof("通知回复成功: comment=%s", commentID)
	return &NotificationReplyResult{
		CommentID: commentID,
		Nickname:  target.from().Nickname,
		FeedID:    target.Item.ID,

View on GitHub (pinned to 332d196854)

Solutions

  1. Retry the call — transient render state often resolves
  2. Check whether Xiaohongshu changed the submit button selector and update the library
  3. Verify the reply content passes frontend validation (length limits) so the submit button stays enabled
  4. Inspect the live DOM to confirm the current selector for the send button
Defensive patterns

Strategy: retry

Validate before calling

if len([]rune(content)) > 500 {
    return fmt.Errorf("reply too long, submit button may be disabled")
}

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

When it happens

Trigger: item.Element('button.submit') fails after typing content — submit button not rendered, selector renamed, or editor closed unexpectedly.

Common situations: Xiaohongshu redesigned the reply editor buttons; typing triggered a validation state that hid the submit button; DOM re-render removed the editor mid-flow.

Related errors


AI-assisted analysis of xpzouying/xiaohongshu-mcp@332d196854 (2026-09-05). Data as JSON: /api/errors/b0b0be10e4921605. Report an issue: GitHub.