issue #20266: Fix error when retrieveRecord is used with context