Backtestshugorun-20261002-200313#15078

Issue #15078 Merged fix PR # Run 2 Oct 2026 · run-20261002-200313 gohugoio/hugo

New content command thinks there's a path conflict for a file that doesn't exist yet

Better

Our patch was judged better than the merged fix.

In this judgment, Patch B = our agent, Patch A = the merged fix.

Both patches make the same core fix: the placeholder file now sets `draft: false`. In Hugo, a page's own front matter overrides cascaded values. So the cascaded `draft: true` from `posts/drafts/_index.md` no longer drops the placeholder page from the build, and the 'no page found / target path conflicts' error goes away. The placeholder's explicit `build:` block already overrides the cascaded `build.render: link`, so draft was the root cause, and both patches fix it.

Correctness: the two are equivalent for the reported scenario. Patch B also sets `BuildExpired` in the `new content` command, next to the existing `BuildFuture`. This covers the parallel case where a cascaded past `expiryDate` would likewise remove the placeholder. It is a small, low-risk change that matches the existing BuildFuture handling, and the code comments explain why each case is handled where it is.

Tests: both add a Go unit test reproducing the issue's `_index.md` cascade, and both tests would fail before the fix. Patch A tests only the leaf-bundle path. Patch B's unit test covers both the leaf bundle and a regular page, and asserts the placeholder text is gone. B also adds an end-to-end testscript through the actual CLI that covers:
- bundles with a custom kind;
- expired-cascade and future-cascade sections;
- a regular `hugo` build still not publishing the drafts, which guards against the fix leaking drafts into output.
That is much stronger evidence.

Scope and craft: B's extra work is tightly related and well commented, and it adds little risk. A is minimal and clean but less thoroughly verified. Overall, B is the better patch.

The judge saw only the two patches, labelled A and B in random order, with issue links and version numbers removed. The reasoning above is shown verbatim.

Solve

46m 2s

Wall-clock time in the container

Full test suite

No new failures

3,673 passed · 93 skipped · 3,775 total

Contamination audit

Clean

No sign the agent saw the real fix

Patch size

109vs 32 merged

Changed lines, ours vs merged

I run my personal blog using Hugo for about two years ago, and it has been great!, but there have been issues with how I create pages.

I have section called posts/drafts/ where I create drafts for posts before I move them to a posts/YEAR/MONTH directory where I can post them. The bug happens when I create the page for a post, like this:

<pre>
hugo new content posts/drafts/trip-to-puebla/index.md
</pre>

Running this command with the debug flag returns the following:

<pre>
INFO build: step process substep collect files 138 files_total 138 pagesources_total 71 resourcesources_total 67 duration 37.1674ms
INFO build: step process duration 38.2639ms
INFO build: step assemble duration 2.064063s
INFO build: step render pages 0 content 0 duration 548.6µs
INFO build: step render deferred count 0 duration 0s
INFO build: step postProcess duration 0s
INFO build: duration 2.1061069s
ERROR no page found for "C:\\...\\Documents\\projects\\kfcmanwebsite2\\content\\posts\\drafts\\trip-to-puebla\\index.md"; the target path conflicts with existing conten
</pre>

What's funny is that a page _is_ created, but it's a placeholder page that looks like this:

---
title: "Content Placeholder"
build:
  render: never
  list: never
  publishResources: false
---

After consulting with ChatGPT (yes you can stone me now) and testing some things here's another stuff that cursed AI and I found:

  • The name of the page still causes some issues, doesn't matter if its trip-to-puebla/index.md or trip-to-puebla.
  • Renaming the drafts directory and rerunning the command with the new name still throws the error
  • This issue does not happen if I run it when creating something like hugo new content posts/2026/07/foo/index.md

One final thing, I have a branch bundle on posts/drafts/_index.md that has the following front matter:

title: Drafts
build:
    render: never

cascade:
    draft: true
    build:
        render: link

weight: 9999
draft: true

This is so any of the pages inside posts/drafts don't get published.

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

<pre>
hugo v0.163.3-4d22555aebf458d5d150500c9ac4bee5b24cf0d3+extended windows/amd64 BuildDate=2026-06-18T16:18:24Z VendorInfo=gohugoio
</pre>

Does this issue reproduce with the latest release?

I'm using the latest version, so it _should_ be reproducible. I think. The repo for my hugo project can be found here, though it may be a little heavy.

The two patches

Our patch+109 −0
commands/new.goindex e82258a79..71253c6d2 100644@@ -54,7 +54,11 @@ Ensure you run this within the root directory of your project.`, 						return newUserError("path needs to be provided") 					} 					cfg := flagsToCfg(cd, nil)+					// The new content may get a future publish date or an expiry+					// date in the past (e.g. via cascade), but we still need the page.+					// Drafts are handled in the content placeholder. 					cfg.Set("BuildFuture", true)+					cfg.Set("BuildExpired", true) 					h, err := r.Hugo(cfg) 					if err != nil { 						return errcreate/content_test.goindex deafaed09..04a85e330 100644@@ -159,6 +159,45 @@ site RegularPages: {{ len site.RegularPages  }} 	cContains(c, readFileFromFs(t, fs.Source, filepath.Join("content", "mypage.md")), `draft: true`) } +func TestNewContentInSectionWithCascadeDraft(t *testing.T) {+	mm := afero.NewMemMapFs()+	c := qt.New(t)++	c.Assert(initFs(mm), qt.IsNil)+	c.Assert(afero.WriteFile(mm, filepath.Join("content", "posts", "drafts", "_index.md"), []byte(`---+title: Drafts+build:+  render: never+cascade:+  draft: true+  build:+    render: link+draft: true+---+`), 0o755), qt.IsNil)++	cfg, fs := newTestCfg(c, mm)+	conf := testconfig.GetTestConfigs(fs.Source, cfg)++	h := func() *hugolib.HugoSites {+		h, err := hugolib.NewHugoSites(deps.DepsCfg{Configs: conf, Fs: fs})+		c.Assert(err, qt.IsNil)+		return h+	}++	// Leaf bundle.+	c.Assert(create.NewContent(h(), "", "posts/drafts/trip-to-puebla/index.md", false), qt.IsNil)+	content := readFileFromFs(t, fs.Source, filepath.Join("content", "posts", "drafts", "trip-to-puebla", "index.md"))+	cContains(c, content, `title: "Trip to Puebla"`)+	c.Assert(content, qt.Not(qt.Contains), "Content Placeholder")++	// Regular page.+	c.Assert(create.NewContent(h(), "", "posts/drafts/my-post.md", false), qt.IsNil)+	content = readFileFromFs(t, fs.Source, filepath.Join("content", "posts", "drafts", "my-post.md"))+	cContains(c, content, `title: "My Post"`)+	c.Assert(content, qt.Not(qt.Contains), "Content Placeholder")+}+ func initFs(fs afero.Fs) error { 	perm := os.FileMode(0o755) 	var err errorhugolib/content_factory.goindex 36cb29e63..ec7a8f735 100644@@ -112,8 +112,11 @@ func (f ContentFactory) CreateContentPlaceHolder(filename string, force bool) (s  	// This will be overwritten later, just write a placeholder to get 	// the paths correct.+	// Set draft to false to prevent a cascaded draft value from removing+	// the page from the build. 	placeholder := `--- title: "Content Placeholder"+draft: false build:   render: never   list: nevertestscripts/commands/new_content_cascade_build.txtnew file mode 100644index 000000000..11edcef1b@@ -0,0 +1,63 @@+# New content below a section that cascades draft and build options.++hugo new content posts/drafts/trip-to-puebla/index.md+grep 'title: "Trip to Puebla"' content/posts/drafts/trip-to-puebla/index.md+! grep 'Content Placeholder' content/posts/drafts/trip-to-puebla/index.md++hugo new content posts/drafts/my-post.md+grep 'title: "My Post"' content/posts/drafts/my-post.md++hugo new content --kind mybundle posts/drafts/my-bundle+grep 'title: "My Bundle"' content/posts/drafts/my-bundle/index.md++# New content below a section that cascades a past expiry date.++hugo new content posts/expired/my-post.md+grep 'title: "My Post"' content/posts/expired/my-post.md+! grep 'Content Placeholder' content/posts/expired/my-post.md++# New content below a section that cascades a future publish date.++hugo new content posts/future/my-post.md+grep 'title: "My Post"' content/posts/future/my-post.md+! grep 'Content Placeholder' content/posts/future/my-post.md++# Drafts are still not published by a regular build.++hugo+! exists public/posts/drafts/trip-to-puebla/index.html+! exists public/posts/drafts/my-post/index.html++-- hugo.toml --+baseURL = "https://example.org/"+disableKinds = ['rss','sitemap','taxonomy','term']+-- layouts/all.html --+{{ .Title }}+-- content/posts/drafts/_index.md --+---+title: Drafts+build:+  render: never+cascade:+  draft: true+  build:+    render: link+weight: 9999+draft: true+---+-- content/posts/expired/_index.md --+---+title: Expired+cascade:+  expiryDate: 2001-01-01+---+-- content/posts/future/_index.md --+---+title: Future+cascade:+  publishDate: 2999-01-01+---+-- archetypes/mybundle/index.md --+---+title: "{{ replace .File.ContentBaseName "-" " " | title }}"+--- 
Merged fix · PR #+32 −0
create/content_test.goindex deafaed09..c8c3c1cdd 100644@@ -159,6 +159,37 @@ site RegularPages: {{ len site.RegularPages  }} 	cContains(c, readFileFromFs(t, fs.Source, filepath.Join("content", "mypage.md")), `draft: true`) } +// See issue 15078.+func TestNewContentWithBuildCascade(t *testing.T) {+	t.Parallel()++	mm := afero.NewMemMapFs()+	c := qt.New(t)++	c.Assert(initFs(mm), qt.IsNil)+	c.Assert(mm.MkdirAll(filepath.Join("content", "posts", "drafts"), 0o755), qt.IsNil)+	c.Assert(afero.WriteFile(mm, filepath.Join("content", "posts", "drafts", "_index.md"), []byte(`---+title: Drafts+build:+  render: never+cascade:+  draft: true+  build:+    render: link+draft: true+---+`), 0o755), qt.IsNil)++	cfg, fs := newTestCfg(c, mm)+	conf := testconfig.GetTestConfigs(fs.Source, cfg)+	h, err := hugolib.NewHugoSites(deps.DepsCfg{Configs: conf, Fs: fs})+	c.Assert(err, qt.IsNil)++	const target = "posts/drafts/trip-to-puebla/index.md"+	c.Assert(create.NewContent(h, "", target, false), qt.IsNil)+	c.Assert(readFileFromFs(c, fs.Source, filepath.Join("content", target)), qt.Contains, `title: "Trip to Puebla"`)+}+ func initFs(fs afero.Fs) error { 	perm := os.FileMode(0o755) 	var err errorhugolib/content_factory.goindex 36cb29e63..6757c64e3 100644@@ -114,6 +114,7 @@ func (f ContentFactory) CreateContentPlaceHolder(filename string, force bool) (s 	// the paths correct. 	placeholder := `--- title: "Content Placeholder"+draft: false build:   render: never   list: never