I had this error because I incorrectly followed the install instructions and put lazy.lua into ~/.config/nvim/config/ instead of ~/.config/nvim/lua/config. Your ~/.config/nvim directory tree should look like this:
.
├── init.lua
└── lua
├── config
│ └── lazy.lua
└── plugins.lua