{"record":{"id":"5cf718d3a00bbba3","repo":"gohugoio/hugo","slug":"no-page-found-for-q-the-target-path-conflicts-wi","errorCode":null,"errorMessage":"no page found for %q; the target path conflicts with existing content","messagePattern":"no page found for %q; the target path conflicts with existing content","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"create/content.go","lineNumber":280,"sourceCode":"\n\tif b.kind != \"\" {\n\t\tpathsToCheck = append(pathsToCheck, b.kind+ext)\n\t}\n\n\tpathsToCheck = append(pathsToCheck, \"default\"+ext)\n\n\tfor _, p := range pathsToCheck {\n\t\tfi, err := b.archeTypeFs.Stat(p)\n\t\tif err == nil {\n\t\t\tb.archetypeFi = fi.(hugofs.FileMetaInfo)\n\t\t\tb.isDir = fi.IsDir()\n\t\t\treturn\n\t\t}\n\t}\n}\n\nfunc errTargetConflict(path string) error {\n\treturn fmt.Errorf(\"no page found for %q; the target path conflicts with existing content\", path)\n}\n\nfunc (b *contentBuilder) applyArcheType(contentFilename string, archetypeFi hugofs.FileMetaInfo) error {\n\tp := b.h.GetContentPage(contentFilename)\n\tif p == nil {\n\t\treturn errTargetConflict(contentFilename)\n\t}\n\n\tf, err := b.sourceFs.Create(contentFilename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\n\tif archetypeFi == nil {\n\t\treturn b.cf.ApplyArchetypeTemplate(f, p, b.kind, DefaultArchetypeTemplateTemplate)\n\t}\n","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/create/content.go#L262-L298","documentation":"errTargetConflict (create/content.go:279) is returned by applyArcheType and buildFile when Hugo's GetContentPage returns nil for the target filename, meaning the path already maps to existing content or collides with a page/bundle. Creating would clobber or shadow existing content, so Hugo aborts (unless force was passed).","triggerScenarios":"`hugo new posts/existing.md` when posts/existing.md already exists; creating a leaf bundle whose path collides with an existing page; re-running a new-content command for a path already scaffolded; a path conflict with an _index.md-based section.","commonSituations":"Re-running hugo new after a previous (possibly failed) run; creating content at a path that overlaps an existing bundle directory.","solutions":["Pass --force to overwrite the existing file/bundle.","Pick a different target path that does not collide.","Remove or rename the conflicting existing file/bundle first.","Check for an _index.md in the same section that is claiming the path."],"exampleFix":"# before\n$ hugo new posts/hello.md   # already exists -> conflict\n\n# after\n$ hugo new posts/hello.md --force","handlingStrategy":"validation","validationCode":"// Detect a path conflict before calling NewContent.\nfunc ResolveConflict(fs afero.Fs, targetPath string) (bool, error) {\n    _, err := fs.Stat(targetPath)\n    if err == nil { return true, nil }\n    if os.IsNotExist(err) { return false, nil }\n    return false, err\n}","typeGuard":null,"tryCatchPattern":"err := create.NewContent(h, kind, targetPath, force)\nif err != nil && strings.Contains(err.Error(), \"conflicts with existing content\") {\n    // decide: overwrite, rename, or abort\n    err = create.NewContent(h, kind, targetPath, true /* force */)\n}","preventionTips":["Check whether the target path already exists before running hugo new.","Use --force only when you intend to overwrite.","Avoid scaffolding into paths occupied by an existing bundle."],"tags":["content","conflict"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}