Before we get too confused, there are two types of lenses, ones that work and ones that dont fully work.
Examples of ones that work are sony AF, minolta AF, and most tamron/tokina/sigma A-mount AF.
Then there are the ones that dont fully work, , genreally manual focus but that can be made to fit with an adaptor, such as some m42, zenitar etc and ones that do fit, are AF and dont work like some (few) of the older Sigma and tamron that need re-chipining and are generally over about 15 years old.
If you are getting the error it should happen with the second lot, but shouldnt happen with the first lot.
If it happens with a lens that should work then your mount may be badly fitting, and reattaching the lens may help. You know a bit like screwing it in further, but not really, it should just give a nice click.
If you are using one of the other lenses or a damaged one of the lenses that should be fully compatible then somewhere in the menue funciton you can turn off the option to get the camera to confirm a propper lens is fitted. It is called something like shutter on no lens, but is different on different cameras of course.