helm issue – error validating data: apiVersion not set

I was using helm to package an infrastructure. when I was trying to execute “helm install” I found the below error:

Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: apiVersion not set

The first thing I was checking is to see whether the location that I was running the command is the location for Chart.yaml and in this case it does stay as the same as Chart.yaml

And then I check the apiVersion under Chart.yaml and this looks fine as well.

Because I was mainly using the sub-chart from tgz file. So I thought there is nothing under templates folder. However, I found a yaml file without apiVersion. So that was the problem.

I removed the test yaml file without apiVersion under the template folder and the helm install start working again.

I think this is a typical issue for helm when ppl forget where to check when it happens. So I just document it here for future reference.