I think I found a way to consistently reproduce the issue:
>>>
* h1
aaaaa
* h2
bbbbb
* h3
bbbbb
* h4
ccccc
<<<
Collapse all. All is fine at this time.
At pos-min call (query-replace) bbb -> zzz: Already when asking whether to replace it cannot expand. h2 and h3 are expansion is broken.
(org-fold-core--clear-isearch-overlays) repairs it.
At pos-max (query-replace) bbb -> zzz does not find a match, and does not break the expansion.


Am Do., 11. Mai 2023 um 11:47 Uhr schrieb Ihor Radchenko <yantar92@posteo.net>:
William Denton <wtd@pobox.com> writes:

>> Does it also help if you run M-: (org-fold-core--clear-isearch-overlays)?
>
> That worked!  I just had the problem.  I ran that, and the tree popped open!

Do you use evil-mode?

--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>