Nil pointer evaluating resource.Resource.RelPermalink

Hugo Resources are available only under two scenarios:

  1. If under the contentDir files are organized in Page Bundles
  2. If the file one wants to fetch as a Hugo Resource resides under the assetDir

It appears that you are doing something different.

Also see the Requesting Help guidelines.