[solved] Runtime error: index out of range

Hi,
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]:
github.com/bep/gitmap.toGitInfo(0xc00020ebd0, 0x66, 0x20669b0, 0x1, 0x0)
        /go/pkg/mod/github.com/bep/gitmap@v1.1.2/gitmap.go:128 +0x3d6
github.com/bep/gitmap.Map(0xc00004a044, 0x31, 0x0, 0x0, 0x31, 0x1, 0x0)
        /go/pkg/mod/github.com/bep/gitmap@v1.1.2/gitmap.go:90 +0x5b3
github.com/gohugoio/hugo/hugolib.newGitInfo(0x23b0a38, 0xc000238a20, 0xd, 0x1, 0xc00007b830)
        /root/project/hugo/hugolib/gitinfo.go:40 +0x6a
github.com/gohugoio/hugo/hugolib.(*HugoSites).loadGitInfo(0xc00025ee40, 0xc0004d25a0, 0xc)
        /root/project/hugo/hugolib/hugo_sites.go:400 +0x8b
github.com/gohugoio/hugo/hugolib.newHugoSites.func4(0x4d1ac8, 0x8, 0x203000, 0x13a8d60)
        /root/project/hugo/hugolib/hugo_sites.go:366 +0x2e
github.com/gohugoio/hugo/lazy.(*Init).Do.func1()
        /root/project/hugo/lazy/init.go:97 +0x134
github.com/gohugoio/hugo/lazy.(*onceMore).Do(0xc0003d5e88, 0xc00007b900)
        /root/project/hugo/lazy/once.go:53 +0xea
github.com/gohugoio/hugo/lazy.(*Init).Do(0xc0003d5e60, 0xc000100000, 0x0, 0x203000, 0x203000)
        /root/project/hugo/lazy/init.go:79 +0x5b
github.com/gohugoio/hugo/lazy.(*Init).Do.func1()
        /root/project/hugo/lazy/init.go:102 +0xbd
github.com/gohugoio/hugo/lazy.(*onceMore).Do(0xc0003d5ca8, 0xc00007b9e8)
        /root/project/hugo/lazy/once.go:53 +0xea
github.com/gohugoio/hugo/lazy.(*Init).Do(0xc0003d5c80, 0x78, 0x1e54aa0, 0x23aa101, 0xc00070a280)
        /root/project/hugo/lazy/init.go:79 +0x5b
github.com/gohugoio/hugo/hugolib.(*HugoSites).gitInfoForPage(0xc00025ee40, 0x23f4040, 0xc00076fc50, 0x0, 0x0, 0x1f422eb)
        /root/project/hugo/hugolib/hugo_sites.go:193 +0x3a
github.com/gohugoio/hugo/hugolib.(*pageMap).newPageFromContentNode(0xc0008f5b60, 0xc0009f4000, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/project/hugo/hugolib/content_map_page.go:132 +0x37a
github.com/gohugoio/hugo/hugolib.(*pageMap).assembleSections.func1(0x234f178, 0x1, 0x1cba360, 0xc0009f4000, 0x1cdd800)
        /root/project/hugo/hugolib/content_map_page.go:473 +0x235
github.com/armon/go-radix.recursiveWalk(0xc0009f4030, 0xc00056dd90, 0xc00007bd40)
        /go/pkg/mod/github.com/armon/go-radix@v1.0.0/radix.go:519 +0xd7
github.com/armon/go-radix.recursiveWalk(0xc0008fefc0, 0xc00056dd90, 0xa19bf6)
        /go/pkg/mod/github.com/armon/go-radix@v1.0.0/radix.go:525 +0x74
github.com/armon/go-radix.(*Tree).Walk(...)
        /go/pkg/mod/github.com/armon/go-radix@v1.0.0/radix.go:447
github.com/gohugoio/hugo/hugolib.(*pageMap).assembleSections(0xc0008f5b60, 0x0, 0xc0008ff020)
        /root/project/hugo/hugolib/content_map_page.go:429 +0x90
github.com/gohugoio/hugo/hugolib.(*pageMap).assemblePages(0xc0008f5b60, 0x0, 0x0)
        /root/project/hugo/hugolib/content_map_page.go:324 +0x73
github.com/gohugoio/hugo/hugolib.(*pageMaps).AssemblePages.func1(0xc0008f5b60, 0x0, 0x0)
        /root/project/hugo/hugolib/content_map_page.go:711 +0x6c
github.com/gohugoio/hugo/hugolib.(*pageMaps).withMaps.func1(0x0, 0x0)
        /root/project/hugo/hugolib/content_map_page.go:779 +0x2e
github.com/gohugoio/hugo/common/para.(*errGroupRunner).Run.func1(0x0, 0x0)
        /root/project/hugo/common/para/para.go:52 +0x2f
golang.org/x/sync/errgroup.(*Group).Go.func1(0xc000aaf050, 0xc00047e120)
        /go/pkg/mod/golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:57 +0x59
created by golang.org/x/sync/errgroup.(*Group).Go
        /go/pkg/mod/golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:54 +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 https://github.com/google/docsy-example.git
  • 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.

2 Likes

Thank you @bep, I have to do something?

@alexandros @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 https://github.com/aborruso/test_docsy
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]:
github.com/bep/gitmap.toGitInfo(0xc00084a150, 0x63, 0x20669b0, 0x1, 0x0)
        /go/pkg/mod/github.com/bep/gitmap@v1.1.2/gitmap.go:128 +0x3d6
github.com/bep/gitmap.Map(0xc00004a044, 0x2e, 0x0, 0x0, 0x2e, 0x1, 0x0)
        /go/pkg/mod/github.com/bep/gitmap@v1.1.2/gitmap.go:90 +0x5b3
github.com/gohugoio/hugo/hugolib.newGitInfo(0x23b0a38, 0xc0002a3170, 0xd, 0x1, 0xc000a73830)
        /root/project/hugo/hugolib/gitinfo.go:40 +0x6a
github.com/gohugoio/hugo/hugolib.(*HugoSites).loadGitInfo(0xc0002c8e40, 0xc0004ac1e0, 0x10000000a)
        /root/project/hugo/hugolib/hugo_sites.go:400 +0x8b
github.com/gohugoio/hugo/hugolib.newHugoSites.func4(0x4d1ac8, 0x8, 0x203000, 0x13a8d60)
        /root/project/hugo/hugolib/hugo_sites.go:366 +0x2e
github.com/gohugoio/hugo/lazy.(*Init).Do.func1()
        /root/project/hugo/lazy/init.go:97 +0x134
github.com/gohugoio/hugo/lazy.(*onceMore).Do(0xc00066be28, 0xc000a73900)
        /root/project/hugo/lazy/once.go:53 +0xea
github.com/gohugoio/hugo/lazy.(*Init).Do(0xc00066be00, 0xc000700400, 0x0, 0x203000, 0x203000)
        /root/project/hugo/lazy/init.go:79 +0x5b
github.com/gohugoio/hugo/lazy.(*Init).Do.func1()
        /root/project/hugo/lazy/init.go:102 +0xbd
github.com/gohugoio/hugo/lazy.(*onceMore).Do(0xc00066bc48, 0xc000a739e8)
        /root/project/hugo/lazy/once.go:53 +0xea
github.com/gohugoio/hugo/lazy.(*Init).Do(0xc00066bc20, 0x78, 0x1e54aa0, 0x23aa101, 0xc00067a580)
        /root/project/hugo/lazy/init.go:79 +0x5b
github.com/gohugoio/hugo/hugolib.(*HugoSites).gitInfoForPage(0xc0002c8e40, 0x23f4040, 0xc0004ee0f0, 0x0, 0x0, 0x1f422eb)
        /root/project/hugo/hugolib/hugo_sites.go:193 +0x3a
github.com/gohugoio/hugo/hugolib.(*pageMap).newPageFromContentNode(0xc000354990, 0xc0004fe300, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/project/hugo/hugolib/content_map_page.go:132 +0x37a
github.com/gohugoio/hugo/hugolib.(*pageMap).assembleSections.func1(0x234f178, 0x1, 0x1cba360, 0xc0004fe300, 0x1cdd800)
        /root/project/hugo/hugolib/content_map_page.go:473 +0x235
github.com/armon/go-radix.recursiveWalk(0xc0004fe330, 0xc000a7bd90, 0xc000a73d40)
        /go/pkg/mod/github.com/armon/go-radix@v1.0.0/radix.go:519 +0xd7
github.com/armon/go-radix.recursiveWalk(0xc0004ee1e0, 0xc000a7bd90, 0xa19bf6)
        /go/pkg/mod/github.com/armon/go-radix@v1.0.0/radix.go:525 +0x74
github.com/armon/go-radix.(*Tree).Walk(...)
        /go/pkg/mod/github.com/armon/go-radix@v1.0.0/radix.go:447
github.com/gohugoio/hugo/hugolib.(*pageMap).assembleSections(0xc000354990, 0x0, 0xc0004ee240)
        /root/project/hugo/hugolib/content_map_page.go:429 +0x90
github.com/gohugoio/hugo/hugolib.(*pageMap).assemblePages(0xc000354990, 0x0, 0x0)
        /root/project/hugo/hugolib/content_map_page.go:324 +0x73
github.com/gohugoio/hugo/hugolib.(*pageMaps).AssemblePages.func1(0xc000354990, 0x0, 0x0)
        /root/project/hugo/hugolib/content_map_page.go:711 +0x6c
github.com/gohugoio/hugo/hugolib.(*pageMaps).withMaps.func1(0x0, 0x0)
        /root/project/hugo/hugolib/content_map_page.go:779 +0x2e
github.com/gohugoio/hugo/common/para.(*errGroupRunner).Run.func1(0x0, 0x0)
        /root/project/hugo/common/para/para.go:52 +0x2f
golang.org/x/sync/errgroup.(*Group).Go.func1(0xc0004d4d80, 0xc0008e02a0)
        /go/pkg/mod/golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:57 +0x59
created by golang.org/x/sync/errgroup.(*Group).Go
        /go/pkg/mod/golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:54 +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