`hugo new` with a subsection marked as draft is causing a panic

On my website (source: GitHub - BBaoVanC/ The source code of my website, uses, if I do hugo new --kind blog blog/drafts/test, then I get a panic:

panic: [BUG] no Page found for "/home/bbaovanc/git-repos/"

goroutine 1 [running]:*contentBuilder).applyArcheType(0xc00025c9c0, {0xc000799e00, 0x47}, {0xc000043340, 0xd})
	/home/bbaovanc/git-repos/hugo/create/content.go:276 +0x354*contentBuilder).buildDir(0xc00025c9c0)
	/home/bbaovanc/git-repos/hugo/create/content.go:179 +0x7c5
	/home/bbaovanc/git-repos/hugo/create/content.go:93 +0x154, {0x7fffdbf2a7bf, 0x4}, {0x7fffdbf2a7c4, 0x5a8f65})
	/home/bbaovanc/git-repos/hugo/create/content.go:108 +0x5fe*newCmd).newContent(0xc000529230, 0xc0003a0000, {0xc0004b6ff0, 0x1, 0x0})
	/home/bbaovanc/git-repos/hugo/commands/new.go:83 +0x150*Command).execute(0xc0003a0000, {0xc0004b6fc0, 0x3, 0x3})
	/home/bbaovanc/.local/share/go/pkg/mod/ +0x60e*Command).ExecuteC(0xc000724780)
	/home/bbaovanc/.local/share/go/pkg/mod/ +0x3bc{0xc00003c0b0, 0x4, 0x4})
	/home/bbaovanc/git-repos/hugo/commands/hugo.go:92 +0xb4
	/home/bbaovanc/git-repos/hugo/main.go:23 +0x58

It’s something in my site specifically though, because if I try this on an empty Hugo site, the same config.yaml, and my theme cloned, then there’s no panic and the archetype is processed properly. The site also generates correctly too.

I cannot reproduce the problem with your data on Ubuntu 20.04.3 LTS using v0.89.4.

git clone --recurse-submodules
hugo new --kind blog blog/drafts/test

Content dir “/home/jmooring/temp/” created

Start building sites … 
hugo v0.89.4-AB01BA6E+extended linux/amd64 BuildDate=2021-11-17T08:24:09Z VendorInfo=gohugoio

                   | EN | ES  
  Pages            | 64 | 10  
  Paginator pages  |  3 |  0  
  Non-page files   | 26 |  0  
  Static files     |  4 |  4  
  Processed images |  0 |  0  
  Aliases          | 28 |  1  
  Sitemaps         |  2 |  1  
  Cleaned          |  0 |  0  

Total in 147 ms

Ah, I think I found the issue now. I only get the panic if I have an inside content/blog/drafts which has draft: true set. If I set it to false or remove the line, it works.

Sorry, still can’t reproduce.

Can you try with these commands?

git clone --recursive
mkdir content/blog/drafts/
echo -e '---\ndraft: true\n---' > content/blog/drafts/
hugo new blog/drafts/test

I can reproduce with those commands on:

  • my main computer (Arch Linux)
  • archlinux:base-devel Docker image
  • ubuntu:jammy Docker image
  • debian:sid Docker image
  • my MacBook (0.89.4 from Homebrew)

Arch Linux, Ubuntu, and Debian repos are out of date, but I can also reproduce it with a binary I built off of the 0.89.4 tag.

Here’s hugo env on my binary I built:

hugo v0.89.4 linux/amd64 BuildDate=unknown
1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.