gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
75.39k stars 7.49k forks source link

Panic when creating new content #11208

Closed deining closed 8 months ago

deining commented 1 year ago

How to reproduce:

Create a new site and change into the site

hugo new site new-site
cd new-site/

Create two content directories:

mkdir -p content/de/docs
mkdir -p content/en/docs

Edit hugo.toml, it should read like this:

defaultContentLanguage = "de"

[languages]
[languages.de]
contentDir = "content/de"
[languages.en]
contentDir = "content/en"

Now try to create a new page via this command:

hugo new content content/en/docs/_index.md

Hugo panics:

panic: [BUG] no Page found for "C:\\Users\\xxx\\path\\to\\new-site\\content\\en\\docs\\_index.md"

goroutine 1 [running]:
github.com/gohugoio/hugo/create.(*contentBuilder).applyArcheType(0xc000001080, {0xc000140580, 0x45}, {0xc0006050a0, 0xa})
        /root/project/hugo/create/content.go:278 +0x35c
github.com/gohugoio/hugo/create.(*contentBuilder).buildFile(0xc000001080)
        /root/project/hugo/create/content.go:246 +0x168
github.com/gohugoio/hugo/create.NewContent.func1()
        /root/project/hugo/create/content.go:105 +0x2b4
github.com/gohugoio/hugo/create.NewContent(0xc000dbc140, {0x0, 0x0}, {0xc00003c280, 0x19}, 0x0)
        /root/project/hugo/create/content.go:109 +0x5ff
github.com/gohugoio/hugo/commands.newNewCommand.func1({0x0?, 0x0?}, 0x0?, 0x0?, {0xc00059bbd0, 0x0?, 0x0?})
        /root/project/hugo/commands/new.go:65 +0x173
github.com/gohugoio/hugo/commands.(*simpleCommand).Run(0x0?, {0x2d51528?, 0xc00003a110?}, 0x0?, {0xc00059bbd0?, 0x0?, 0x0?})
        /root/project/hugo/commands/commandeer.go:595 +0x43
github.com/bep/simplecobra.(*Commandeer).compile.func1(0xc000497800?, {0xc00059bbd0?, 0x1?, 0x1?})
        /root/project/gomodcache/github.com/bep/simplecobra@v0.3.2/simplecobra.go:113 +0x52
github.com/spf13/cobra.(*Command).execute(0xc000497800, {0xc00059bb90, 0x1, 0x1})
        /root/project/gomodcache/github.com/spf13/cobra@v1.7.0/command.go:940 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0xc000004f00)
        /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(0xc0007b91b8, {0x2d51528?, 0xc00003a110?}, {0xc00005a090?, 0x415b28?, 0xc00007b138?})
        /root/project/gomodcache/github.com/bep/simplecobra@v0.3.2/simplecobra.go:155 +0xd9
github.com/gohugoio/hugo/commands.Execute({0xc00005a090, 0x3, 0x3})
        /root/project/hugo/commands/commandeer.go:66 +0x312
main.main()
        /root/project/hugo/main.go:25 +0x65

Does this issue reproduce with the latest release?

Yes

jmooring commented 1 year ago

Related:

jmooring commented 8 months ago

This is fixed in v0.123.0.

github-actions[bot] commented 7 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.