What does this GO error mean?

Hello all,

I was looking at setting up a hugo theme following the these instructions. Right after creating my project, when copying the exampleSite files into my project root and running hugo server I get the below GO error:

panic: interface conversion: interface {} is string, not map[string]interface {}

goroutine 1 [running]:
github.com/nicksnyder/go-i18n/i18n/bundle.parseTranslations(0xc0004e334c, 0x7, 0xc000215180, 0x33f, 0x33f, 0xd16ad1, 0xc000856d20, 0xc000872000, 0x33f, 0xc000215180)
	github.com/nicksnyder/go-i18n/i18n/bundle/bundle.go:100 +0x761
github.com/nicksnyder/go-i18n/i18n/bundle.(*Bundle).ParseTranslationFileBytes(0xc000856ae0, 0xc0004e334c, 0x7, 0xc000215180, 0x33f, 0x33f, 0xc0004e32ac, 0xc0001091e0)
	github.com/nicksnyder/go-i18n/i18n/bundle/bundle.go:75 +0xdb
github.com/gohugoio/hugo/langs/i18n.addTranslationFile(0xc000856ae0, 0x214fe40, 0xc0004b82d0, 0x4, 0x0)
	github.com/gohugoio/hugo/langs/i18n/translationProvider.go:98 +0x13f
github.com/gohugoio/hugo/langs/i18n.(*TranslationProvider).Update(0xc000767040, 0xc000851440, 0x0, 0x0)
	github.com/gohugoio/hugo/langs/i18n/translationProvider.go:79 +0x2d3
github.com/gohugoio/hugo/deps.(*Deps).LoadResources(0xc000851440, 0x0, 0x0)
	github.com/gohugoio/hugo/deps/deps.go:178 +0x43
github.com/gohugoio/hugo/hugolib.applyDeps(0xc000731080, 0xc000795180, 0xc000712120, 0x0, 0x0, 0x2149c40, 0xc000295440, 0xc0001a3000, 0x19, 0x27, ...)
	github.com/gohugoio/hugo/hugolib/hugo_sites.go:466 +0x395
github.com/gohugoio/hugo/hugolib.newHugoSites(0xc000731080, 0xc000795180, 0x0, 0x0, 0x0, 0x2149c40, 0xc000295440, 0x0, 0x0, 0x0, ...)
	github.com/gohugoio/hugo/hugolib/hugo_sites.go:355 +0x5d8
github.com/gohugoio/hugo/hugolib.NewHugoSites(0xc000731080, 0xc000795180, 0x0, 0x0, 0x0, 0x2149c40, 0xc000295440, 0x0, 0x0, 0x0, ...)
	github.com/gohugoio/hugo/hugolib/hugo_sites.go:488 +0x113
github.com/gohugoio/hugo/commands.(*commandeer).loadConfig.func3()
	github.com/gohugoio/hugo/commands/commandeer.go:399 +0x264
sync.(*Once).doSlow(0xc000345450, 0xc00063f940)
	sync/once.go:66 +0xe3
sync.(*Once).Do(...)
	sync/once.go:57
github.com/gohugoio/hugo/commands.(*commandeer).loadConfig(0xc00078a270, 0xc000780101, 0x2105a80, 0xc0004567b0)
	github.com/gohugoio/hugo/commands/commandeer.go:358 +0x865
github.com/gohugoio/hugo/commands.newCommandeer(0x101, 0xc0003c6340, 0x2103340, 0xc0003ecbc0, 0xc0004189c0, 0x0, 0x0, 0x0, 0x1ad8020, 0xc000308c00, ...)
	github.com/gohugoio/hugo/commands/commandeer.go:185 +0x241
github.com/gohugoio/hugo/commands.initializeConfig(0x101, 0xc0003c6340, 0x2103340, 0xc0003ecbc0, 0xc0004189c0, 0x0, 0x0, 0xc0000b6c90)
	github.com/gohugoio/hugo/commands/hugo.go:123 +0x76
github.com/gohugoio/hugo/commands.(*serverCmd).server(0xc0003ecbc0, 0xc000104000, 0x2ea7da8, 0x0, 0x0, 0x0, 0x0)
	github.com/gohugoio/hugo/commands/server.go:238 +0x1c5
github.com/spf13/cobra.(*Command).execute(0xc000104000, 0x2ea7da8, 0x0, 0x0, 0xc000104000, 0x2ea7da8)
	github.com/spf13/cobra/command.go:826 +0x460
github.com/spf13/cobra.(*Command).ExecuteC(0xc00070ca00, 0xc000456560, 0xc00063fec0, 0x177b022)
	github.com/spf13/cobra/command.go:914 +0x2fb
github.com/gohugoio/hugo/commands.Execute(0xc00000e070, 0x1, 0x1, 0x408fcf, 0xc0000360b8, 0x0, 0x0)
	github.com/gohugoio/hugo/commands/hugo.go:89 +0xb9
main.main()
	github.com/gohugoio/hugo/main.go:23 +0x6c

What does the above error mean? Is it a syntax error or something like a missing error? Which file is complaining?
I don’t know GO at all and am quite lost here…

Thanks!

You are more likely to receive an accurate and timely response if you post a link to the public repository for your project.

See https://discourse.gohugo.io/t/requesting-help/9132.

Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

Apologies, this is the repo.

git clone --recurse-submodules https://github.com/themefisher/airspace-hugo
cd airspace-hugo
cd exampleSite
hugo server --theme ../..
Start building sites … 
hugo v0.111.0-DEV-9af78d11003ed22b6281e47e1ac19568cf1cca81+extended linux/amd64 BuildDate=2023-02-08T09:22:20Z

                   | EN | FR | IT | DE  
-------------------+----+----+----+-----
  Pages            | 60 | 60 | 60 | 60  
  Paginator pages  |  1 |  1 |  1 |  1  
  Non-page files   |  0 |  0 |  0 |  0  
  Static files     | 29 | 29 | 29 | 29  
  Processed images | 13 |  0 |  0 |  0  
  Aliases          | 15 | 14 | 14 | 14  
  Sitemaps         |  2 |  1 |  1 |  1  
  Cleaned          |  0 |  0 |  0 |  0  

No problems.

If you are having a problem with your site, then you need to share the repo for your site.

Thank you! That is interesting, the exact same commands produce this error on my machine:

$ git clone --recurse-submodules https://github.com/themefisher/airspace-hugo
Cloning into 'airspace-hugo'...
remote: Enumerating objects: 2879, done.
remote: Total 2879 (delta 0), reused 0 (delta 0), pack-reused 2879
Receiving objects: 100% (2879/2879), 13.29 MiB | 5.58 MiB/s, done.
Resolving deltas: 100% (1474/1474), done.
$ cd airspace-hugo/exampleSite/
$ hugo server --theme ../..
panic: interface conversion: interface {} is string, not map[string]interface {}

goroutine 1 [running]:
github.com/nicksnyder/go-i18n/i18n/bundle.parseTranslations(0xc0004e75d6, 0x7, 0xc000215180, 0x33f, 0x33f, 0xd16ad1, 0xc000650630, 0xc00065a000, 0x33f, 0xc000215180)
	github.com/nicksnyder/go-i18n/i18n/bundle/bundle.go:100 +0x761
github.com/nicksnyder/go-i18n/i18n/bundle.(*Bundle).ParseTranslationFileBytes(0xc0006503f0, 0xc0004e75d6, 0x7, 0xc000215180, 0x33f, 0x33f, 0xc0004e7536, 0xc00019e680)
	github.com/nicksnyder/go-i18n/i18n/bundle/bundle.go:75 +0xdb
github.com/gohugoio/hugo/langs/i18n.addTranslationFile(0xc0006503f0, 0x214fe40, 0xc0001bc2d0, 0x4, 0x0)
	github.com/gohugoio/hugo/langs/i18n/translationProvider.go:98 +0x13f
github.com/gohugoio/hugo/langs/i18n.(*TranslationProvider).Update(0xc000634b60, 0xc00064e120, 0x0, 0x0)
	github.com/gohugoio/hugo/langs/i18n/translationProvider.go:79 +0x2d3
github.com/gohugoio/hugo/deps.(*Deps).LoadResources(0xc00064e120, 0x0, 0x0)
	github.com/gohugoio/hugo/deps/deps.go:178 +0x43
github.com/gohugoio/hugo/hugolib.applyDeps(0xc0005fabd0, 0xc0003cccc0, 0xc0004e3680, 0x0, 0x0, 0x2149c40, 0xc0001eb8c0, 0xc0001a3000, 0x19, 0x27, ...)
	github.com/gohugoio/hugo/hugolib/hugo_sites.go:466 +0x395
github.com/gohugoio/hugo/hugolib.newHugoSites(0xc0005fabd0, 0xc0003cccc0, 0x0, 0x0, 0x0, 0x2149c40, 0xc0001eb8c0, 0x0, 0x0, 0x0, ...)
	github.com/gohugoio/hugo/hugolib/hugo_sites.go:355 +0x5d8
github.com/gohugoio/hugo/hugolib.NewHugoSites(0xc0005fabd0, 0xc0003cccc0, 0x0, 0x0, 0x0, 0x2149c40, 0xc0001eb8c0, 0x0, 0x0, 0x0, ...)
	github.com/gohugoio/hugo/hugolib/hugo_sites.go:488 +0x113
github.com/gohugoio/hugo/commands.(*commandeer).loadConfig.func3()
	github.com/gohugoio/hugo/commands/commandeer.go:399 +0x264
sync.(*Once).doSlow(0xc000848e20, 0xc00081f940)
	sync/once.go:66 +0xe3
sync.(*Once).Do(...)
	sync/once.go:57
github.com/gohugoio/hugo/commands.(*commandeer).loadConfig(0xc00082da00, 0xc000820101, 0x2105a80, 0xc00084c2f0)
	github.com/gohugoio/hugo/commands/commandeer.go:358 +0x865
github.com/gohugoio/hugo/commands.newCommandeer(0xc000000101, 0xc0006e36c0, 0x2103340, 0xc0003f3800, 0xc0003ee3a0, 0x0, 0x0, 0x0, 0x1ad8020, 0xc000857400, ...)
	github.com/gohugoio/hugo/commands/commandeer.go:185 +0x241
github.com/gohugoio/hugo/commands.initializeConfig(0x101, 0xc0006e36c0, 0x2103340, 0xc0003f3800, 0xc0003ee3a0, 0x0, 0x0, 0xc0002e7e58)
	github.com/gohugoio/hugo/commands/hugo.go:123 +0x76
github.com/gohugoio/hugo/commands.(*serverCmd).server(0xc0003f3800, 0xc0007d2780, 0xc0003ee240, 0x0, 0x2, 0x0, 0x0)
	github.com/gohugoio/hugo/commands/server.go:238 +0x1c5
github.com/spf13/cobra.(*Command).execute(0xc0007d2780, 0xc0003ee1a0, 0x2, 0x2, 0xc0007d2780, 0xc0003ee1a0)
	github.com/spf13/cobra/command.go:826 +0x460
github.com/spf13/cobra.(*Command).ExecuteC(0xc00084a500, 0xc00084c090, 0xc000663ec0, 0x177b022)
	github.com/spf13/cobra/command.go:914 +0x2fb
github.com/gohugoio/hugo/commands.Execute(0xc000032110, 0x3, 0x3, 0x408fcf, 0xc0000380b8, 0x0, 0x0)
	github.com/gohugoio/hugo/commands/hugo.go:89 +0xb9
main.main()
	github.com/gohugoio/hugo/main.go:23 +0x6c
$

I’ve tried cloning this within a newly created hugo project’s theme directory and also tried with a random non-hugo folder on the filesystem and am getting the same response.

Not sure if this is something to do with my environment, but I am cloning the same repo and running the same commands as you but getting a different outcome…

$ hugo version 
Hugo Static Site Generator v0.68.3/extended linux/amd64 BuildDate: 2020-03-25T06:15:45Z
$ hugo env 
Hugo Static Site Generator v0.68.3/extended linux/amd64 BuildDate: 2020-03-25T06:15:45Z
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.13.8"
$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.5 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
$

It doesn’t crash with v0.76.0 or later.

I suggest you upgrade. The current version is v0.110.0.

1 Like