This error is listed in the manual.
It is active when it can’t detect the lens that is attached and in any mode other than A or M. If your lens is an AF D or AF-S, there may be an issue with the digital connection. If it is an AI or Ai-s lens, will need to follow the steps in the manual to activate a manual lens configuration. (Page 269-270 of the manual for the list of compatible lenses)
Since you have stated that changing lenses doesn’t fix the issue (and assuming the lenses work on another camera), that it may be an issue with the contacts on the top of the camera body. It could be the contacts are not seated right, dirty, or it could be the cable has dislodged internally, so is not communicating correctly.
Help with bayonet d7000 Nikon has a picture attached to the answer that has the part view (connector is labelled “1H998-161(5)”), which may require opening the camera up to service it. There are several guides which may help with the service.