Lens errors are fairly common. Usually it's sand or grit interfering with the lens extension mechanism. Or the camera's been dropped with the lens extended. Or the camera has been powered on, but the lens had been blocked preventing its extension. Or the battery ran down with the lens extended ...Here are some troubleshooting steps
that you can try that may (or may not) correct it. They only seem to work for less than 40% of the lens errors, but if the camera is out of warranty (or repair cost approaches that of the camera), they're worth that try. Some of the later steps do involve some risk to the camera, so carefully weigh your options before deciding to conduct them. These steps include tips for lens errors occurring from a dropped/damaged camera.
But if this problem just randomly occurred (i.e. you did NOT drop your camera), then also see this video. It's likely that just some sand or other particles are jamming the gears or lens of your camera. The simple steps in this video can overcome that problem.