Skip to content

Commit

Permalink
Add diagnostic hints to init timeout message
Browse files Browse the repository at this point in the history
Expand the text in the init timeout message to give the reader more hints as to what may be causing the issue.

The current error sent me on a wild goose chase trying to debug my shortcodes, but it turned out that the issue was just that I wasn't caching my resources/ directory on my build server. Once I found this blog post, I solved the issue in minutes:

https://www.henriksommerfeld.se/hugo-timeout-not-a-circular-loop-in-shortcode/

Googling the error message yields several additional posts from users who focus on loops in their shortcode when the problem seems to be overly-expensive builds.
  • Loading branch information
mtlynch authored and bep committed Apr 27, 2020
1 parent c2d9fd1 commit fe60b7d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lazy/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func (ini *Init) withTimeout(timeout time.Duration, f func(ctx context.Context)

select {
case <-ctx.Done():
return nil, errors.New("timed out initializing value. This is most likely a circular loop in a shortcode")
return nil, errors.New("timed out initializing value. You may have a circular loop in a shortcode, or your site may have resources that take longer to build than the `timeout` limit in your Hugo config file.")
case ve := <-c:
return ve.v, ve.err
}
Expand Down

0 comments on commit fe60b7d

Please sign in to comment.