It seems to be happened when there are no go files under the package.
In my case I just forgot to run the templ generate so the package contains .templ files only and got this error.
templ generate
.templ