Solved — Hugo error “Error calling first: both limit and seq must be provided”

I’ve suddenly started to get the following error, and I’ve no idea why:

Error building site: failed to render pages: render of “page” failed: “/artkavanagh_e7c8cd/layouts/tabarchive/single.html:7:9”: execute of template failed: template: tabarchive/single.html:7:9: executing “main” at : error calling first: both limit and seq must be provided

I made changes yesterday to a different template, which also uses “first”, but I can’t see how those changes (all of which I’ve reversed anyway) could affect this template, which I haven’t changed and was previously working fine.

Here’s the relevant section of the template:

{{ $postlist := site.Data.postlist }}
{{ range first 26 .Site.Taxonomies.categories.newsletter  }}
    {{ $postdate := .Date.Format "02-Jan-2006" }}
        <h2 class="archiveitem"><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
        <p><a href="{{ .Permalink }}" class="archivelink">
        {{ $postdate }}<br>
        {{ $currentTitle := printf "%s" .Title }}
        {{ range $postlist.posts }}
            {{ if eq .posttitle $currentTitle }}
                {{ .postdescription }}
            {{ end }}
        {{ end }}
</a></p>
{{ end }}

I’d be very grateful if anyone can tell me what’s causing the problem, and how I can fix it. Thanks.

Sorry, ignore this. I should have thought of rebuilding the site before I posted!

I’ve seen this too sporadically and I’m not really sure why it happens, to be honest. Glad that fixed it, though.

1 Like