in reply to what error does this signify?

It means that the regex in the pattern match is not well formed. It happens to be /$mappingfield/, so it's hard to tell without seeing what's in $mappingfield. Wild guess, but I may well be wrong: you may want /\Q$mappingfield/. But then also look at index.

BTW: use <code> tags to format code in your posts.