xpzouying/xiaohongshu-mcp · error

部分商品未找到: %v

Error message

部分商品未找到: %v

What it means

bindProducts returns this Errorf when one or more product keywords could not be found/selected by searchAndSelectProduct. The failed keywords are listed in the message; other errors during binding were only logged as warnings and collected here. It means the product search on the platform returned no match for those terms.

Source

Thrown at xiaohongshu/publish.go:1171

		time.Sleep(500 * time.Millisecond)
	}

	// 点击保存按钮
	slog.Info("准备点击保存按钮")
	if err := clickModalSaveButton(modal); err != nil {
		return errors.Wrap(err, "点击保存按钮失败")
	}
	slog.Info("保存按钮点击完成,开始等待弹窗关闭")

	// 等待弹窗关闭
	if err := waitForModalClose(page); err != nil {
		slog.Warn("等待弹窗关闭超时", "error", err)
	} else {
		slog.Info("弹窗已关闭")
	}

	if len(failedProducts) > 0 {
		return errors.Errorf("部分商品未找到: %v", failedProducts)
	}

	slog.Info("商品绑定完成", "total", len(products))
	time.Sleep(1000 * time.Millisecond)
	return nil
}

// clickAddProductButton 点击"添加商品"按钮
func clickAddProductButton(page *rod.Page) error {
	slog.Info("开始查找添加商品按钮")

	// 查找包含"添加商品"文本的元素
	spans, err := page.Elements("span.d-text")
	if err != nil {
		return errors.Wrap(err, "查找商品按钮文本失败")
	}

	for _, span := range spans {

View on GitHub (pinned to 332d196854)

Solutions

  1. Read the failedProducts list from the message and correct/remove those keywords
  2. Search the platform manually to confirm each product's current title
  3. Use shorter, distinctive keywords instead of exact long titles
  4. Retry the flow — transient search failures can cause false negatives
Defensive patterns

Strategy: validation

Validate before calling

// pre-validate product keywords against your config
for _, p := range products {
    if strings.TrimSpace(p) == "" { return fmt.Errorf("商品关键词为空") }
}
// optionally check failed list from a prior run before re-submitting

Try / catch

err := bindProducts(ctx, page, products)
if err != nil {
    var failed []string
    if _, scanErr := fmt.Sscanf(err.Error(), "部分商品未找到: %v", &failed); scanErr == nil {
        // correct/remove these keywords and retry binding only for them
    }
}

Prevention

When it happens

Trigger: A product keyword in the products list matches no item in the product-selection search; the search box or result list failed for that keyword; the modal state got stale mid-loop.

Common situations: Product renamed or delisted since the keyword list was configured; typos or over-specific keywords; search rate-limiting causing empty results after the first few lookups.

Related errors


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