Invalid field path passed to record::search()

Getting the below error. Anyone have any ideas what might be causing this? Thanks

Invalid field path passed to record::search() - : Service > Procurement engagement form: Actual VAT amount (PRO0001926GBHRW1). Field belongs to object Service > Procurement engagement form (OBJ0000140GBHRW1), however expected object is CASE (OBJ0000056GBHRW1).

It means there is a mismatch in a database query. Is this from Code Studio, or something else?
It could be an issue in CS code, or a misconfigured page/widget/presenter maybe. Hard to be sure unless you can narrow down to a specific place/feature.

I have looked at a similar issue recently, it’s somewhere in code studio.

In my case, the issue came up during an access check that retrieved the logged-in user ID and created a cs.record from it. Then, it tried to call record.get(cs.ref(“ref_to_a_subset_field”)) to check if the user was part of a certain subset which is Based at System Users. The same error occurred because there was no initial check to confirm whether the user belonged to the base object of that subset.

So when a Build user opened the page, the access check code tried to search for a Build User down that path but since Build users can’t be part of that subset ever and dont have that path, the reference path wasn’t defined for them and the same error was happening

I would suggest to find where the code is running any kind of search or record.get using those objects and double check that when you look for a field path on that record, the defined field path actually can belong to the record

Thanks very much both. Really useful.