return WithFileContext(e, realFilename, f, matcher)
 }
 
+// WithFileContextForFileDefault tries to add file context using the default line matcher.
+func WithFileContextForFileDefault(err error, filename string, fs afero.Fs) error {
+       err, _ = WithFileContextForFile(
+               err,
+               filename,
+               filename,
+               fs,
+               SimpleLineMatcher)
+       return err
+}
+
 // WithFileContextForFile will try to add a file context with lines matching the given matcher.
 // If no match could be found, the original error is returned with false as the second return value.
 func WithFileContext(e error, realFilename string, r io.Reader, matcher LineMatcherFn) (error, bool) {
 
        "path/filepath"
        "strings"
 
+       "github.com/gohugoio/hugo/common/herrors"
+
        "github.com/pkg/errors"
 
        "github.com/gohugoio/hugo/common/paths"
 func FromFile(fs afero.Fs, filename string) (Provider, error) {
        m, err := loadConfigFromFile(fs, filename)
        if err != nil {
-               return nil, err
+               return nil, herrors.WithFileContextForFileDefault(err, filename, fs)
        }
        return NewFrom(m), nil
 }
 
 }
 
 func (l configLoader) wrapFileError(err error, filename string) error {
-       err, _ = herrors.WithFileContextForFile(
-               err,
-               filename,
-               filename,
-               l.Fs,
-               herrors.SimpleLineMatcher)
-       return err
+       return herrors.WithFileContextForFileDefault(err, filename, l.Fs)
 }
 
                        var err error
                        tc.cfg, err = config.FromFile(c.fs, configFilename)
                        if err != nil {
-                               return errors.Wrapf(err, "failed to read module config for %q in %q", tc.Path(), configFilename)
+                               return err
                        }
                }