I believe I just found a current problem related to the "Invalid Menu Operation" warning that has been discussed on this forum several times before.
I'm working on a project that has a lot of compositions.
If a composition is used more than 1168 times and I try to right-click it in the Project panel, I get an "After Effects Warning: Invalid Menu Operation" popup.
I tested it in CC 2020 and CC 2022 - same bug.
I had four different pre-comps used over 1168 times in other compositions. As a test, I just kept deleting the comps that used the pre-comps, and as soon as I deleted enough comps that the pre-comp was used 1168 times or less, the bug went away - no more pop-up and I could right-click the comp and use the menu. This happened for all four of the pre-comps that were used over 1168 times.
I searched, and haven't seen anyone else report this specific problem / cause / solution.