The lens contacts are dirty. Get a pencil with an eraser on the end, just a regular old pencil with a red rubber eraser. Detach the lens from the camera, hold it so that the lens’ gold contacts are pointing down and lightly erase their exposed surface, cleaning them of any hand oil that might have gotten on them.
Do the same thing with the gold contacts inside the camera body. This is a bit harder but it’s doable: just hold camera so lens opening points down so no gunk falls in. Erase lightly. I used a lens cloth and dabbed at the contacts rather than blow them so as not to blow the erasings inside the camera.