[solved] Runtime error: index out of range

I’m trying to install docsy a Hugo theme for technical documentation sets, but I have runtime error.

I have already written an issue on the official space, but they cannot help me and they suggested me to write here.

I have:

  • go version go1.15.8 linux/amd64
  • debian 11 bullseye
  • hugo extended. I have had the same kind of error using both release 0.83.1 and 0.75.1

When I run hugo server I have something like the below error.
What could my problem be?

Thank you

Start building sites …
panic: runtime error: index out of range [5] with length 1

goroutine 114 [running]:, 0x66, 0x20669b0, 0x1, 0x0)
        /go/pkg/mod/ +0x3d6, 0x31, 0x0, 0x0, 0x31, 0x1, 0x0)
        /go/pkg/mod/ +0x5b3, 0xc000238a20, 0xd, 0x1, 0xc00007b830)
        /root/project/hugo/hugolib/gitinfo.go:40 +0x6a*HugoSites).loadGitInfo(0xc00025ee40, 0xc0004d25a0, 0xc)
        /root/project/hugo/hugolib/hugo_sites.go:400 +0x8b, 0x8, 0x203000, 0x13a8d60)
        /root/project/hugo/hugolib/hugo_sites.go:366 +0x2e*Init).Do.func1()
        /root/project/hugo/lazy/init.go:97 +0x134*onceMore).Do(0xc0003d5e88, 0xc00007b900)
        /root/project/hugo/lazy/once.go:53 +0xea*Init).Do(0xc0003d5e60, 0xc000100000, 0x0, 0x203000, 0x203000)
        /root/project/hugo/lazy/init.go:79 +0x5b*Init).Do.func1()
        /root/project/hugo/lazy/init.go:102 +0xbd*onceMore).Do(0xc0003d5ca8, 0xc00007b9e8)
        /root/project/hugo/lazy/once.go:53 +0xea*Init).Do(0xc0003d5c80, 0x78, 0x1e54aa0, 0x23aa101, 0xc00070a280)
        /root/project/hugo/lazy/init.go:79 +0x5b*HugoSites).gitInfoForPage(0xc00025ee40, 0x23f4040, 0xc00076fc50, 0x0, 0x0, 0x1f422eb)
        /root/project/hugo/hugolib/hugo_sites.go:193 +0x3a*pageMap).newPageFromContentNode(0xc0008f5b60, 0xc0009f4000, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/project/hugo/hugolib/content_map_page.go:132 +0x37a*pageMap).assembleSections.func1(0x234f178, 0x1, 0x1cba360, 0xc0009f4000, 0x1cdd800)
        /root/project/hugo/hugolib/content_map_page.go:473 +0x235, 0xc00056dd90, 0xc00007bd40)
        /go/pkg/mod/ +0xd7, 0xc00056dd90, 0xa19bf6)
        /go/pkg/mod/ +0x74*Tree).Walk(...)
        /go/pkg/mod/*pageMap).assembleSections(0xc0008f5b60, 0x0, 0xc0008ff020)
        /root/project/hugo/hugolib/content_map_page.go:429 +0x90*pageMap).assemblePages(0xc0008f5b60, 0x0, 0x0)
        /root/project/hugo/hugolib/content_map_page.go:324 +0x73*pageMaps).AssemblePages.func1(0xc0008f5b60, 0x0, 0x0)
        /root/project/hugo/hugolib/content_map_page.go:711 +0x6c*pageMaps).withMaps.func1(0x0, 0x0)
        /root/project/hugo/hugolib/content_map_page.go:779 +0x2e*errGroupRunner).Run.func1(0x0, 0x0)
        /root/project/hugo/common/para/para.go:52 +0x2f*Group).Go.func1(0xc000aaf050, 0xc00047e120)
        /go/pkg/mod/ +0x59
created by*Group).Go
        /go/pkg/mod/ +0x66

You need to share your project or a minimal project that reproduces the issue.

On the linked GitHub issue I saw that you managed to generate a site with Docsy while using a plain Hello World content file.

Therefore it seems that something is going on with your particular setup and/or content files.

1 Like

I have generated another hugo site, only to verify if I have a general problem.

My steps were only:

  • git clone
  • cd docsy-example
  • git submodule update --init --recursive
  • hugo server

As soon as I can I share a repo.

Thank you

I created this to track it: Missing bounds check in gitmap · Issue #8627 · gohugoio/hugo · GitHub

I’m not sure what triggers it, but we should certainly handle that error situation more … lenient.


Thank you @bep, I have to do something?

@onedrawingperday @bep here an example repo of mine: GitHub - aborruso/test_docsy

My steps Getting Started | Docsy

I have the error after hugo server

Unable to reproduce.

git clone --recurse-submodules
cd test_docsy
npm install
hugo server
                   | FA | NO | EN  
  Pages            | 18 | 76 | 46  
  Paginator pages  |  0 |  0 |  0  
  Non-page files   |  3 |  1 |  3  
  Static files     | 38 | 38 | 38  
  Processed images |  8 |  2 |  7  
  Aliases          |  3 |  0 |  3  
  Sitemaps         |  2 |  1 |  1  
  Cleaned          |  0 |  0 |  0  
1 Like

I know, but I have no idea on how to solve it :frowning:

Thank you for your test

What happens if you do exactly what I did? Start in a new, empty directory.

I have my errors

Start building sites …
panic: runtime error: index out of range [5] with length 1

goroutine 120 [running]:, 0x63, 0x20669b0, 0x1, 0x0)
        /go/pkg/mod/ +0x3d6, 0x2e, 0x0, 0x0, 0x2e, 0x1, 0x0)
        /go/pkg/mod/ +0x5b3, 0xc0002a3170, 0xd, 0x1, 0xc000a73830)
        /root/project/hugo/hugolib/gitinfo.go:40 +0x6a*HugoSites).loadGitInfo(0xc0002c8e40, 0xc0004ac1e0, 0x10000000a)
        /root/project/hugo/hugolib/hugo_sites.go:400 +0x8b, 0x8, 0x203000, 0x13a8d60)
        /root/project/hugo/hugolib/hugo_sites.go:366 +0x2e*Init).Do.func1()
        /root/project/hugo/lazy/init.go:97 +0x134*onceMore).Do(0xc00066be28, 0xc000a73900)
        /root/project/hugo/lazy/once.go:53 +0xea*Init).Do(0xc00066be00, 0xc000700400, 0x0, 0x203000, 0x203000)
        /root/project/hugo/lazy/init.go:79 +0x5b*Init).Do.func1()
        /root/project/hugo/lazy/init.go:102 +0xbd*onceMore).Do(0xc00066bc48, 0xc000a739e8)
        /root/project/hugo/lazy/once.go:53 +0xea*Init).Do(0xc00066bc20, 0x78, 0x1e54aa0, 0x23aa101, 0xc00067a580)
        /root/project/hugo/lazy/init.go:79 +0x5b*HugoSites).gitInfoForPage(0xc0002c8e40, 0x23f4040, 0xc0004ee0f0, 0x0, 0x0, 0x1f422eb)
        /root/project/hugo/hugolib/hugo_sites.go:193 +0x3a*pageMap).newPageFromContentNode(0xc000354990, 0xc0004fe300, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/project/hugo/hugolib/content_map_page.go:132 +0x37a*pageMap).assembleSections.func1(0x234f178, 0x1, 0x1cba360, 0xc0004fe300, 0x1cdd800)
        /root/project/hugo/hugolib/content_map_page.go:473 +0x235, 0xc000a7bd90, 0xc000a73d40)
        /go/pkg/mod/ +0xd7, 0xc000a7bd90, 0xa19bf6)
        /go/pkg/mod/ +0x74*Tree).Walk(...)
        /go/pkg/mod/*pageMap).assembleSections(0xc000354990, 0x0, 0xc0004ee240)
        /root/project/hugo/hugolib/content_map_page.go:429 +0x90*pageMap).assemblePages(0xc000354990, 0x0, 0x0)
        /root/project/hugo/hugolib/content_map_page.go:324 +0x73*pageMaps).AssemblePages.func1(0xc000354990, 0x0, 0x0)
        /root/project/hugo/hugolib/content_map_page.go:711 +0x6c*pageMaps).withMaps.func1(0x0, 0x0)
        /root/project/hugo/hugolib/content_map_page.go:779 +0x2e*errGroupRunner).Run.func1(0x0, 0x0)
        /root/project/hugo/common/para/para.go:52 +0x2f*Group).Go.func1(0xc0004d4d80, 0xc0008e02a0)
        /go/pkg/mod/ +0x59
created by*Group).Go
        /go/pkg/mod/ +0x66

I have solved: if you use WSL on windows you must run docsy not on a mounted windows folder, you must use a Linux one.

Thank you to all