xpzouying/xiaohongshu-mcp · error

feed not found in noteDetailMap

Error message

feed %s not found in noteDetailMap

What it means

The unmarshaled noteDetailMap does not contain an entry for the requested feedID, so extractFeedDetail throws 'feed %s not found in noteDetailMap'. The page loaded but its initial state has no data for this note.

Solutions

  1. Verify the feedID matches exactly how it appears in the page's noteDetailMap keys (log available keys)
  2. Refresh the feed ID from a current feeds list
  3. Check whether the note is deleted/blocked in a browser

Example fix

// before
return nil, fmt.Errorf("feed %s not found in noteDetailMap", feedID)
// after — debug aid
keys := make([]string, 0, len(noteDetailMap)); for k := range noteDetailMap { keys = append(keys, k) }
return nil, fmt.Errorf("feed %s not found in noteDetailMap (keys: %v)", feedID, keys)
Defensive patterns

Strategy: validation

Validate before calling

// pre-validate the ID format before calling
if feedID == "" || len(feedID) < 16 {
    return fmt.Errorf("invalid feedID %q", feedID)
}

Try / catch

detail, err := client.GetFeedDetailWithConfig(ctx, feedID, cfg)
if err != nil && strings.Contains(err.Error(), "not found in noteDetailMap") {
    log.Warnf("stale/missing feed %s", feedID)
    return nil // skip
}

Prevention

When it happens

Trigger: Requesting a note ID that was deleted/blocked (state present but empty), a typo'd or stale feed ID, or key mismatch because the map is keyed by a different ID form.

Common situations: Using cached feed IDs from an old crawl; note removed between listing and detail fetch; xiaohongshu keying the map under a differently-formatted ID (e.g. with xsec_token).

Related errors


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

Appendix: source

Thrown at xiaohongshu/feed_detail.go:994

		return nil, fmt.Errorf("提取Feed详情失败: %w", err)
	}

	if result == "" {
		return nil, errors.ErrNoFeedDetail
	}

	var noteDetailMap map[string]struct {
		Note     FeedDetail  `json:"note"`
		Comments CommentList `json:"comments"`
	}

	if err := json.Unmarshal([]byte(result), &noteDetailMap); err != nil {
		return nil, fmt.Errorf("failed to unmarshal noteDetailMap: %w", err)
	}

	noteDetail, exists := noteDetailMap[feedID]
	if !exists {
		return nil, fmt.Errorf("feed %s not found in noteDetailMap", feedID)
	}

	return &FeedDetailResponse{
		Note:     noteDetail.Note,
		Comments: noteDetail.Comments,
	}, nil
}

func makeFeedDetailURL(feedID, xsecToken string) string {
	return fmt.Sprintf("https://www.xiaohongshu.com/explore/%s?xsec_token=%s&xsec_source=pc_feed", feedID, xsecToken)
}

View on GitHub (pinned to 332d196854)