#2550·OpenCLI

xiaohongshu search: filter panel detection broken on current XHS UI (layout … ambiguous_option)

Author: allen1477404075-engCreated Sep 26, 2026Updated Sep 29, 2026

Summary

Any non-default search filter on opencli xiaohongshu search fails against the current xiaohongshu.com front-end:

$ opencli xiaohongshu search "苏州医美" --limit 3 --sort latest -f json
ok: false
error:
  code: COMMAND_EXEC
  message: Xiaohongshu search filter layout did not match the expected visible panel (ambiguous_option).
  exitCode: 1

Default filters (--sort comprehensive --note-type all --publish-time anytime --scope all --location all) work once the separate MutationObserver bug is fixed (see the sibling issue), because with defaults there is nothing to apply. So the failure is specific to the "apply the filter chips" step.

Environment

  • opencli 1.8.8 (latest on npm at time of writing), Node v22.22.3, macOS 26.3, Chrome extension v1.0.24
  • Logged-in session (opencli xiaohongshu whoami → logged_in: true)
  • Page renders search results normally; only the filter panel cannot be driven

Where it fails

clis/xiaohongshu/search.js:

  • buildApplySearchFiltersJs(requestedFilters) (~line 370) drives the filter panel opened from the "筛选" control
  • the JS returns { status: 'layout', detail: options.length ? 'ambiguous_option' : 'option_not_found' } (~line 420) when it cannot identify a unique visible option in the expected group panel
  • requireFilterApplication() turns that into the COMMAND_EXEC above

On the current UI, the "筛选" popover groups (排序依据 / 笔记类型 / 发布时间 / 搜索范围 / 位置距离) no longer resolve to a single visible option element per group — the detector finds several candidates (ambiguous_option) instead of one, so the click target cannot be determined.

Reproduce

bash
opencli xiaohongshu search "关键词" --limit 5 --sort latest -f json       # 排序依据
opencli xiaohongshu search "关键词" --limit 5 --note-type video -f json   # 笔记类型
opencli xiaohongshu search "关键词" --limit 5 --publish-time week -f json # 发布时间

Suggested direction

  • Make option matching scoped to the opened group panel (the popover subtree that contains the group label) instead of matching by label text alone across the document, which is the usual cause of ambiguous_option.
  • Treat "the popover layout is unknown" as a soft failure: return the default-sorted results and warn (--strict-filters to hard-fail), so the extremely common default search path is never blocked by a filter-panel refactor.

Note

If you are tempted to work around this by skipping the filter step whenever it errors, please don't — with --sort/--publish-time etc. that silently returns default-ordered results that the caller believes are filtered. A visible error is better than a silent wrong result.