CaiJimmy / hugo-theme-stack

Card-style Hugo theme designed for bloggers
https://stack.jimmycai.com
GNU General Public License v3.0
5.06k stars 1.66k forks source link

[Bug]: Update theme workflow failed after Hugo v0.112 #821

Closed aster-hu closed 1 year ago

aster-hu commented 1 year ago

What happened?

The update-theme workflow indicates a panic error panic: runtime error: index out of range [0] with length 0. It seems like an issue caused by Hugo's latest release v0.112.1.

As a workaround, changing the Hugo version back to v0.111.3 solved the issue for me:

            - name: Setup Hugo
              uses: peaceiris/actions-hugo@v2
              with:
                  hugo-version: 0.111.3
                  extended: true

Could you please look into this to prevent future issue? My workflow file is the same as update-theme.yml in hugo-theme-stack-starter

Many thanks.

Hugo version

latest

Theme version

3.12.0

What browsers are you seeing the problem on?

Safari

More information about the browser

macOS Ventura 13.3.1

Relevant log output

Run hugo mod get -u github.com/CaiJimmy/hugo-theme-stack/v3
  hugo mod get -u github.com/CaiJimmy/hugo-theme-stack/v3
  shell: /usr/bin/bash -e {0}
hugo: collected modules in 1588 ms
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/gohugoio/hugo/modules.ApplyProjectConfigDefaults({0x2a17160?, 0xc000bfe180}, {0x3bed7f8, 0x0, 0x1?})
    /root/project/hugo/modules/config.go:89 +0x109d
github.com/gohugoio/hugo/config/allconfig.(*Configs).Init(0xc00051f600)
    /root/project/hugo/config/allconfig/allconfig.go:648 +0x206
github.com/gohugoio/hugo/config/allconfig.LoadConfig({{0x2a169a0, 0x3bed180}, {0x2a19e30, 0xc0001f1800}, {0x2a178f0, 0xc000130d40}, {0x0, 0x0}, {0x234f9b6, 0x6}, ...})
    /root/project/hugo/config/allconfig/load.go:88 +0x8f7
github.com/gohugoio/hugo/commands.(*rootCommand).ConfigFromProvider.func1(0x1f1898?)
    /root/project/hugo/commands/commandeer.go:222 +0x358
github.com/bep/lazycache.(*Cache[...]).GetOrCreate(0x2a28b60, 0x0, 0xc00093fa98?)
    /root/project/gomodcache/github.com/bep/lazycache@v0.2.0/lazycache.go:112 +0x142
github.com/gohugoio/hugo/commands.(*rootCommand).ConfigFromProvider(0xc00043f840?, 0x0?, {0x2a178f0, 0xc000130d40})
    /root/project/hugo/commands/commandeer.go:198 +0x68
github.com/gohugoio/hugo/commands.newModCommands.func12({0x1?, 0xc0000cdee0?}, 0xc00093fbb8?, 0xc000142140, {0xc0000cdec0?, 0x2, 0x2})
    /root/project/hugo/commands/mod.go:257 +0x1c5
github.com/gohugoio/hugo/commands.(*simpleCommand).Run(0x1?, {0x2a0b3d8?, 0xc000050130?}, 0x0?, {0xc0000cdec0?, 0xc0000cdee0?, 0xc00093fbd0?})
    /root/project/hugo/commands/commandeer.go:602 +0x43
github.com/bep/simplecobra.(*Commandeer).compile.func1(0xc00093fca0?, {0xc0000cdec0?, 0x7ffc7d3a3e44?, 0x2?})
    /root/project/gomodcache/github.com/bep/simplecobra@v0.3.1/simplecobra.go:113 +0x52
github.com/spf13/cobra.(*Command).execute(0xc000af7800, {0xc0000cdec0, 0x2, 0x2})
    /root/project/gomodcache/github.com/spf13/cobra@v1.7.0/command.go:940 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0xc000005800)
    /root/project/gomodcache/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3bd
github.com/spf13/cobra.(*Command).ExecuteContextC(...)
    /root/project/gomodcache/github.com/spf13/cobra@v1.7.0/command.go:1001
github.com/bep/simplecobra.(*Exec).Execute(0xc000015510, {0x2a0b3d8?, 0xc000050130?}, {0xc000040060?, 0x509b88?, 0xc000073168?})
    /root/project/gomodcache/github.com/bep/simplecobra@v0.3.1/simplecobra.go:155 +0xd9
github.com/gohugoio/hugo/commands.Execute({0xc000040060, 0x4, 0x4})
    /root/project/hugo/commands/commandeer.go:65 +0x312
main.main()
    /root/project/hugo/main.go:25 +0x65
Error: Process completed with exit code 2.

Link to the page with bug

https://demo.stack.jimmycai.com

Link to the source repository

No response

CaiJimmy commented 1 year ago

I guess this has to be related to Hugo 0.112.x’s CLI refactoring. I’m afraid the only solution is to stay in the old version until this gets fixed.

Thanks for the workaround!

CaiJimmy commented 1 year ago

This seems to be fixed already (I tested on 0.115.2).

image