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 ...
Now as the camera is only three weeks old, you need to take it back to the store where you purchased it for exchange or refund. Do not attempt to repair it yourself at this point as it will void your warranty. Which brings up the next step, if the store refuses to help you, contact Nikon for warranty repair.
For others experiencing this problem, who do not have the luxury of warranty options,
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: