Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic when trying to create a page resource with "hugo new" #12786

Open
shinguz opened this issue Aug 20, 2024 · 8 comments
Open

panic when trying to create a page resource with "hugo new" #12786

shinguz opened this issue Aug 20, 2024 · 8 comments
Labels

Comments

@shinguz
Copy link

shinguz commented Aug 20, 2024

What version of Hugo are you using (hugo version)?

$ hugo version
hugo v0.133.0-c9777473d1369f812d727a6c07dc57ad7be7bf62 linux/amd64 BuildDate=2024-08-17T19:57:41Z VendorInfo=gohugoio

Does this issue reproduce with the latest release?

yes

How to reproduce:

hugo new site bugreport
cd bugreport/

hugo new theme bugreport
echo "theme = 'bugreport'" >>hugo.toml

hugo new content wiki/index.md
hugo new content wiki/marketing/index.md
hugo new content wiki/marketing/applying-for-official-public-mandates/index.md
hugo new content wiki/marketing/conferences/index.md
hugo new content wiki/marketing/fromdual-partner/index.md
hugo new content wiki/marketing/spam/index.md
hugo new content wiki/marketing/who-is-who/index.md

Content "/tmp/oli/bugreport/content/wiki/index.md" created
panic: [BUG] no Page found for "/tmp/oli/bugreport/content/wiki/marketing/index.md"

goroutine 1 [running]:
github.com/gohugoio/hugo/create.(*contentBuilder).applyArcheType(0xc000a12300, {0xc0009cefc0, 0x32}, {0x376f8c0, 0xc0002dec80})
        /root/project/hugo/create/content.go:273 +0x346
github.com/gohugoio/hugo/create.(*contentBuilder).buildFile(0xc000a12300)
        /root/project/hugo/create/content.go:242 +0x1ad
github.com/gohugoio/hugo/create.NewContent.func1()
        /root/project/hugo/create/content.go:103 +0x15f
github.com/gohugoio/hugo/create.NewContent(0xc00074f900, {0x0, 0x0}, {0x7ffce72dee90, 0x17}, 0x0)
        /root/project/hugo/create/content.go:106 +0x5c6
github.com/gohugoio/hugo/commands.newNewCommand.func1({0x0?, 0x0?}, 0x0?, 0xc00074e500, {0xc000892f70, 0x0?, 0x0?})
        /root/project/hugo/commands/new.go:60 +0x15a
github.com/gohugoio/hugo/commands.(*simpleCommand).Run(0x0?, {0x3762010?, 0x4f1b440?}, 0x0?, {0xc000892f70?, 0xc000891a28?, 0x0?})
        /root/project/hugo/commands/commandeer.go:618 +0x3c
github.com/bep/simplecobra.(*Commandeer).compile.func1(0xc000914e00?, {0xc000892f70?, 0x4?, 0x297b307?})
        /root/project/gomodcache/github.com/bep/simplecobra@v0.4.0/simplecobra.go:113 +0x4c
github.com/spf13/cobra.(*Command).execute(0xc000612608, {0xc000892f30, 0x1, 0x1})
        /root/project/gomodcache/github.com/spf13/cobra@v1.8.1/command.go:985 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0xc0009a9208)
        /root/project/gomodcache/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).ExecuteContextC(...)
        /root/project/gomodcache/github.com/spf13/cobra@v1.8.1/command.go:1050
github.com/bep/simplecobra.(*Exec).Execute(0xc00098e998, {0x3762010?, 0x4f1b440?}, {0xc000050110?, 0x46f47d?, 0x0?})
        /root/project/gomodcache/github.com/bep/simplecobra@v0.4.0/simplecobra.go:155 +0xd4
github.com/gohugoio/hugo/commands.Execute({0xc000050110, 0x3, 0x3})
        /root/project/hugo/commands/commandeer.go:68 +0x2ed
main.main()
        /root/project/hugo/main.go:25 +0x56
panic: [BUG] no Page found for "/tmp/oli/bugreport/content/wiki/marketing/applying-for-official-public-mandates/index.md"

goroutine 1 [running]:
github.com/gohugoio/hugo/create.(*contentBuilder).applyArcheType(0xc000993440, {0xc0000620c0, 0x58}, {0x376f8c0, 0xc00030bc80})
        /root/project/hugo/create/content.go:273 +0x346
github.com/gohugoio/hugo/create.(*contentBuilder).buildFile(0xc000993440)
        /root/project/hugo/create/content.go:242 +0x1ad
github.com/gohugoio/hugo/create.NewContent.func1()
        /root/project/hugo/create/content.go:103 +0x15f
github.com/gohugoio/hugo/create.NewContent(0xc000619cc0, {0x0, 0x0}, {0x7ffe73c07e6a, 0x3d}, 0x0)
        /root/project/hugo/create/content.go:106 +0x5c6
github.com/gohugoio/hugo/commands.newNewCommand.func1({0x0?, 0x0?}, 0x0?, 0xc000618dc0, {0xc0002d8d70, 0x0?, 0x0?})
        /root/project/hugo/commands/new.go:60 +0x15a
github.com/gohugoio/hugo/commands.(*simpleCommand).Run(0x0?, {0x3762010?, 0x4f1b440?}, 0x0?, {0xc0002d8d70?, 0xc00088fa28?, 0x0?})
        /root/project/hugo/commands/commandeer.go:618 +0x3c
github.com/bep/simplecobra.(*Commandeer).compile.func1(0xc000658b00?, {0xc0002d8d70?, 0x4?, 0x297b307?})
        /root/project/gomodcache/github.com/bep/simplecobra@v0.4.0/simplecobra.go:113 +0x4c
github.com/spf13/cobra.(*Command).execute(0xc000750c08, {0xc0002d8d30, 0x1, 0x1})
        /root/project/gomodcache/github.com/spf13/cobra@v1.8.1/command.go:985 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0xc000627b08)
        /root/project/gomodcache/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).ExecuteContextC(...)
        /root/project/gomodcache/github.com/spf13/cobra@v1.8.1/command.go:1050
github.com/bep/simplecobra.(*Exec).Execute(0xc000898e10, {0x3762010?, 0x4f1b440?}, {0xc0001400d0?, 0x46f47d?, 0xc00008a660?})
        /root/project/gomodcache/github.com/bep/simplecobra@v0.4.0/simplecobra.go:155 +0xd4
github.com/gohugoio/hugo/commands.Execute({0xc0001400d0, 0x3, 0x3})
        /root/project/hugo/commands/commandeer.go:68 +0x2ed
main.main()
        /root/project/hugo/main.go:25 +0x56
panic: [BUG] no Page found for "/tmp/oli/bugreport/content/wiki/marketing/conferences/index.md"

goroutine 1 [running]:
github.com/gohugoio/hugo/create.(*contentBuilder).applyArcheType(0xc000a4c300, {0xc000983c40, 0x3e}, {0x376f8c0, 0xc0002e4c40})
        /root/project/hugo/create/content.go:273 +0x346
github.com/gohugoio/hugo/create.(*contentBuilder).buildFile(0xc000a4c300)
        /root/project/hugo/create/content.go:242 +0x1ad
github.com/gohugoio/hugo/create.NewContent.func1()
        /root/project/hugo/create/content.go:103 +0x15f
github.com/gohugoio/hugo/create.NewContent(0xc0007228c0, {0x0, 0x0}, {0x7ffc83b90e84, 0x23}, 0x0)
        /root/project/hugo/create/content.go:106 +0x5c6
github.com/gohugoio/hugo/commands.newNewCommand.func1({0x0?, 0x0?}, 0x0?, 0xc0005337c0, {0xc0005b6100, 0x0?, 0x0?})
        /root/project/hugo/commands/new.go:60 +0x15a
github.com/gohugoio/hugo/commands.(*simpleCommand).Run(0x0?, {0x3762010?, 0x4f1b440?}, 0x0?, {0xc0005b6100?, 0xc000917a28?, 0x0?})
        /root/project/hugo/commands/commandeer.go:618 +0x3c
github.com/bep/simplecobra.(*Commandeer).compile.func1(0xc000950c00?, {0xc0005b6100?, 0x4?, 0x297b307?})
        /root/project/gomodcache/github.com/bep/simplecobra@v0.4.0/simplecobra.go:113 +0x4c
github.com/spf13/cobra.(*Command).execute(0xc0008f4f08, {0xc0005b60b0, 0x1, 0x1})
        /root/project/gomodcache/github.com/spf13/cobra@v1.8.1/command.go:985 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0xc000944f08)
        /root/project/gomodcache/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).ExecuteContextC(...)
        /root/project/gomodcache/github.com/spf13/cobra@v1.8.1/command.go:1050
github.com/bep/simplecobra.(*Exec).Execute(0xc000514a70, {0x3762010?, 0x4f1b440?}, {0xc000050110?, 0x46f47d?, 0x0?})
        /root/project/gomodcache/github.com/bep/simplecobra@v0.4.0/simplecobra.go:155 +0xd4
github.com/gohugoio/hugo/commands.Execute({0xc000050110, 0x3, 0x3})
        /root/project/hugo/commands/commandeer.go:68 +0x2ed
main.main()
        /root/project/hugo/main.go:25 +0x56
panic: [BUG] no Page found for "/tmp/oli/bugreport/content/wiki/marketing/fromdual-partner/index.md"

goroutine 1 [running]:
github.com/gohugoio/hugo/create.(*contentBuilder).applyArcheType(0xc000a66240, {0xc0001c0370, 0x43}, {0x376f8c0, 0xc0003727c0})
        /root/project/hugo/create/content.go:273 +0x346
github.com/gohugoio/hugo/create.(*contentBuilder).buildFile(0xc000a66240)
        /root/project/hugo/create/content.go:242 +0x1ad
github.com/gohugoio/hugo/create.NewContent.func1()
        /root/project/hugo/create/content.go:103 +0x15f
github.com/gohugoio/hugo/create.NewContent(0xc00019adc0, {0x0, 0x0}, {0x7ffec3ba6e7f, 0x28}, 0x0)
        /root/project/hugo/create/content.go:106 +0x5c6
github.com/gohugoio/hugo/commands.newNewCommand.func1({0x0?, 0x0?}, 0x0?, 0xc0004dda40, {0xc0009321f0, 0x0?, 0x0?})
        /root/project/hugo/commands/new.go:60 +0x15a
github.com/gohugoio/hugo/commands.(*simpleCommand).Run(0x0?, {0x3762010?, 0x4f1b440?}, 0x0?, {0xc0009321f0?, 0xc00098fa28?, 0x0?})
        /root/project/hugo/commands/commandeer.go:618 +0x3c
github.com/bep/simplecobra.(*Commandeer).compile.func1(0xc0001bbc00?, {0xc0009321f0?, 0x4?, 0x297b307?})
        /root/project/gomodcache/github.com/bep/simplecobra@v0.4.0/simplecobra.go:113 +0x4c
github.com/spf13/cobra.(*Command).execute(0xc00067c908, {0xc0009321b0, 0x1, 0x1})
        /root/project/gomodcache/github.com/spf13/cobra@v1.8.1/command.go:985 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0xc0001d6f08)
        /root/project/gomodcache/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).ExecuteContextC(...)
        /root/project/gomodcache/github.com/spf13/cobra@v1.8.1/command.go:1050
github.com/bep/simplecobra.(*Exec).Execute(0xc00012ed90, {0x3762010?, 0x4f1b440?}, {0xc0001400d0?, 0x46f47d?, 0xc00008a660?})
        /root/project/gomodcache/github.com/bep/simplecobra@v0.4.0/simplecobra.go:155 +0xd4
github.com/gohugoio/hugo/commands.Execute({0xc0001400d0, 0x3, 0x3})
        /root/project/hugo/commands/commandeer.go:68 +0x2ed
main.main()
        /root/project/hugo/main.go:25 +0x56
panic: [BUG] no Page found for "/tmp/oli/bugreport/content/wiki/marketing/spam/index.md"

goroutine 1 [running]:
github.com/gohugoio/hugo/create.(*contentBuilder).applyArcheType(0xc000abf680, {0xc000aa5300, 0x37}, {0x376f8c0, 0xc00017b180})
        /root/project/hugo/create/content.go:273 +0x346
github.com/gohugoio/hugo/create.(*contentBuilder).buildFile(0xc000abf680)
        /root/project/hugo/create/content.go:242 +0x1ad
github.com/gohugoio/hugo/create.NewContent.func1()
        /root/project/hugo/create/content.go:103 +0x15f
github.com/gohugoio/hugo/create.NewContent(0xc000639680, {0x0, 0x0}, {0x7ffe15c6ae8b, 0x1c}, 0x0)
        /root/project/hugo/create/content.go:106 +0x5c6
github.com/gohugoio/hugo/commands.newNewCommand.func1({0x0?, 0x0?}, 0x0?, 0xc000638780, {0xc00076c9c0, 0x0?, 0x0?})
        /root/project/hugo/commands/new.go:60 +0x15a
github.com/gohugoio/hugo/commands.(*simpleCommand).Run(0x0?, {0x3762010?, 0x4f1b440?}, 0x0?, {0xc00076c9c0?, 0xc00088fa28?, 0x0?})
        /root/project/hugo/commands/commandeer.go:618 +0x3c
github.com/bep/simplecobra.(*Commandeer).compile.func1(0xc0005e0b00?, {0xc00076c9c0?, 0x4?, 0x297b307?})
        /root/project/gomodcache/github.com/bep/simplecobra@v0.4.0/simplecobra.go:113 +0x4c
github.com/spf13/cobra.(*Command).execute(0xc0006b4c08, {0xc00076c980, 0x1, 0x1})
        /root/project/gomodcache/github.com/spf13/cobra@v1.8.1/command.go:985 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0xc0001d2f08)
        /root/project/gomodcache/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).ExecuteContextC(...)
        /root/project/gomodcache/github.com/spf13/cobra@v1.8.1/command.go:1050
github.com/bep/simplecobra.(*Exec).Execute(0xc000520ee0, {0x3762010?, 0x4f1b440?}, {0xc000050110?, 0x46f47d?, 0x0?})
        /root/project/gomodcache/github.com/bep/simplecobra@v0.4.0/simplecobra.go:155 +0xd4
github.com/gohugoio/hugo/commands.Execute({0xc000050110, 0x3, 0x3})
        /root/project/hugo/commands/commandeer.go:68 +0x2ed
main.main()
        /root/project/hugo/main.go:25 +0x56
panic: [BUG] no Page found for "/tmp/oli/bugreport/content/wiki/marketing/who-is-who/index.md"

goroutine 1 [running]:
github.com/gohugoio/hugo/create.(*contentBuilder).applyArcheType(0xc000a98cc0, {0xc000aaa140, 0x3d}, {0x376f8c0, 0xc000329380})
        /root/project/hugo/create/content.go:273 +0x346
github.com/gohugoio/hugo/create.(*contentBuilder).buildFile(0xc000a98cc0)
        /root/project/hugo/create/content.go:242 +0x1ad
github.com/gohugoio/hugo/create.NewContent.func1()
        /root/project/hugo/create/content.go:103 +0x15f
github.com/gohugoio/hugo/create.NewContent(0xc0007988c0, {0x0, 0x0}, {0x7ffff07a9e85, 0x22}, 0x0)
        /root/project/hugo/create/content.go:106 +0x5c6
github.com/gohugoio/hugo/commands.newNewCommand.func1({0x0?, 0x0?}, 0x0?, 0xc000673900, {0xc0004e9cd0, 0x0?, 0x0?})
        /root/project/hugo/commands/new.go:60 +0x15a
github.com/gohugoio/hugo/commands.(*simpleCommand).Run(0x0?, {0x3762010?, 0x4f1b440?}, 0x0?, {0xc0004e9cd0?, 0xc00090fa28?, 0x0?})
        /root/project/hugo/commands/commandeer.go:618 +0x3c
github.com/bep/simplecobra.(*Commandeer).compile.func1(0xc000939000?, {0xc0004e9cd0?, 0x4?, 0x297b307?})
        /root/project/gomodcache/github.com/bep/simplecobra@v0.4.0/simplecobra.go:113 +0x4c
github.com/spf13/cobra.(*Command).execute(0xc000722c08, {0xc0004e9c90, 0x1, 0x1})
        /root/project/gomodcache/github.com/spf13/cobra@v1.8.1/command.go:985 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0xc0001d6608)
        /root/project/gomodcache/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).ExecuteContextC(...)
        /root/project/gomodcache/github.com/spf13/cobra@v1.8.1/command.go:1050
github.com/bep/simplecobra.(*Exec).Execute(0xc000532cd8, {0x3762010?, 0x4f1b440?}, {0xc0001400d0?, 0x46f47d?, 0xc00008a660?})
        /root/project/gomodcache/github.com/bep/simplecobra@v0.4.0/simplecobra.go:155 +0xd4
github.com/gohugoio/hugo/commands.Execute({0xc0001400d0, 0x3, 0x3})
        /root/project/hugo/commands/commandeer.go:68 +0x2ed
main.main()
        /root/project/hugo/main.go:25 +0x56

tree content/wi*

rm -rf public/*
hugo --logLevel=info --buildDrafts --cleanDestinationDir
Start building sites … 
hugo v0.133.0-c9777473d1369f812d727a6c07dc57ad7be7bf62 linux/amd64 BuildDate=2024-08-17T19:57:41Z VendorInfo=gohugoio

INFO  static: removing all files from destination that don't exist in static dirs
INFO  static: syncing static files to / duration 274.961µs
INFO  build:  step process substep collect files 13 files_total 13 pages_total 6 resources_total 7 duration 1.340805ms
INFO  build:  step process duration 3.346736ms
INFO  build:  step assemble duration 635.68µs
INFO  build:  step render substep pages site en outputFormat html duration 17.857029ms
INFO  build:  step render substep pages site en outputFormat rss duration 1.862449ms
INFO  build:  step render pages 19 content 11 duration 19.896276ms
INFO  build:  step render deferred count 0 duration 1.145µs
INFO  build:  step postProcess duration 17.801µs
INFO  build:  duration 24.096302ms

                   | EN  
-------------------+-----
  Pages            | 25  
  Paginator pages  |  0  
  Non-page files   |  1  
  Static files     |  1  
  Processed images |  0  
  Aliases          |  0  
  Cleaned          |  0  

Total in 31 ms

--> We do not get any error here! :-(

tree content/wi*
content/wiki
├── index.md
└── marketing
    ├── applying-for-official-public-mandates
    │   └── index.md
    ├── conferences
    │   └── index.md
    ├── fromdual-partner
    │   └── index.md
    ├── index.md
    ├── spam
    │   └── index.md
    └── who-is-who
        └── index.md

tree public/wi*
public/wiki
└── index.html
@shinguz
Copy link
Author

shinguz commented Aug 20, 2024

My biggest pain was, that hugo server did NOT show any error. Hugo did just not render the public files. I spent hours and was asking 2 hugo cracks and nobody could help me. So it would be good if hugo / hugo server would throw the error as well. I do not know if this is the same error or if this is a second error...

@shinguz
Copy link
Author

shinguz commented Aug 20, 2024

Just a note: this is IMHO a blocking issue (at least for us). Just in case you have such states for issues.

@shinguz
Copy link
Author

shinguz commented Aug 20, 2024

And I am more than happy and willing to test fixes... :-)

@shinguz
Copy link
Author

shinguz commented Aug 20, 2024

Seems to be a workaround for all others that suffer...
hugo --printUnusedTemplates --printPathWarnings

@fthorns
Copy link

fthorns commented Aug 20, 2024

Hi there,

try to create the base structure like this:

hugo new site bugreport
cd bugreport/

hugo new theme bugreport
echo "theme = 'bugreport'" >>hugo.toml

hugo new content wiki/_index.md
hugo new content wiki/marketing/_index.md
hugo new content wiki/marketing/applying-for-official-public-mandates.md
hugo new content wiki/marketing/conferences.md
hugo new content wiki/marketing/fromdual-partner.md
hugo new content wiki/marketing/spam.md
hugo new content wiki/marketing/who-is-who.md

This should result in this content directory:

$ tree content/
content/
└── wiki
    ├── _index.md
    └── marketing
        ├── applying-for-official-public-mandates.md
        ├── conferences.md
        ├── fromdual-partner.md
        ├── _index.md
        ├── spam.md
        └── who-is-who.md

Now run hugo -D and enjoy your public/ folder :D

@shinguz
Copy link
Author

shinguz commented Aug 22, 2024

I downgraded hugo to version 0.128.2 and 0.132.2. And these versions work like a charm, at least for me.

@scopartu
Copy link

You also don't need hugo new content. hugo new is the standard way to do it.

@jmooring jmooring changed the title hugo new content throws stack trace / hugo server does not show error panic when trying to create a page resource with "hugo new" Sep 6, 2024
@jmooring
Copy link
Member

jmooring commented Sep 6, 2024

To reproduce:

hugo new site foo
cd foo
hugo new content content/p1/index.md
hugo new content content/p1/p2.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants