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

Server panics when archetype is modified #12195

Closed
anandkkpr opened this issue Mar 1, 2024 · 2 comments · Fixed by #12240
Closed

Server panics when archetype is modified #12195

anandkkpr opened this issue Mar 1, 2024 · 2 comments · Fixed by #12240

Comments

@anandkkpr
Copy link

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

Hugo Version: hugo v0.123.4+extended linux/amd64 BuildDate=unknown
(Built using golang compiler as described here: Build from source.

Does this issue reproduce with the latest release?

Yes (I'm on the latest release).

Environment

  • OS: Fedora Linux
    • uname -a: Linux HOSTNAME 6.7.6-200.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Feb 23 18:27:29 UTC 2024 x86_64 GNU/Linux
  • Path to folder: /home/USERNAME/www/project.name

Project File Structure

.
├── archetypes
│   └── default.md
├── assets
│   ├── scripts
│   │   └── main.ts
│   └── scss
│       └── styles.scss
├── config
│   └── _default
│       ├── config.yml
│       ├── menus.yml
│       ├── params.yml
│       ├── security.yml
│       └── taxonomies.yml
├── content
│   ├── _index.md
│   ├── about.md
│   ├── privacy-policy.md
│   ├── terms-and-conditions.md
│   ├── artwork
│   │   ├── _index.md
│   │   └── 2023-01-01_40x60
│   │       └── img
│   │           ├── primary
│   │           │   └── primary_768x1024_00.jpg
│   │           └── secondary
│   └── updates
│       ├── _index.md
│       ├── event1
│       │   └── index.md
│       ├── event2
│       │   └── index.md
│       └── event3
│           ├── _index.md
│           └── subevent1
│               ├── event4.md
│               └── event5.md
├── data
│       └── .gitkeep
├── layouts
│   ├── 404.html
│   ├── _default
│   │   ├── baseof.html
│   │   ├── home.html
│   │   ├── list.html
│   │   └── single.html
│   ├── partials
│   │   └── menus
│   │       ├── basic
│   │       │   ├── recursion-full.html
│   │       │   ├── recursion-none.html
│   │       │   └── sectional.html
│   │       ├── iconographic
│   │       │   └── social-media.html
│   │       └── special-purpose
│   │           └── a11y-jump-navigation.html
│   └── shortcodes
├── static
│   ├── fonts
│   │   ├── afacad
│   │   │   ├── Afacad-SemiBold.ttf
│   │   │   └── afacad-normal.css
│   │   ├── fonts.css
│   │   └── rem
│   │       ├── REM-Black.ttf
│   │       └── rem-normal.css
│   └── img
│       ├── galleries
│       │   └── artwork
│       │       ├── 10.jpg
│       │       ├── 11.jpg
│       │       ├── 12.jpg
│       │       ├── 13.jpg
│       │       ├── 14.jpg
│       │       ├── 15.jpg
│       │       ├── 16.jpg
│       │       ├── 17.jpg
│       │       ├── 18.jpg
│       │       ├── 19.jpg
│       │       ├── 20.jpg
│       │       ├── 21.jpg
│       │       ├── 22.jpg
│       │       ├── 23.jpg
│       │       ├── 4.jpg
│       │       ├── 5.jpg
│       │       ├── 6.jpg
│       │       ├── 7.jpg
│       │       ├── 8.jpg
│       │       └── 9.jpg
│       └── logo
│               └── logo.jpg
├── themes
│   └── .gitkeep
├── package.json
├── postcss.config.js
├── tailwind.config.js
├── tsconfig.json
├── vite.config.js
└── yarn.lock

Error Stack

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

Built in 839 ms
Environment: "development"
Serving pages from disk
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1) 
Press Ctrl+C to stop

Change detected, rebuilding site (#1).
2024-03-01 15:57:47.874 -0500
Total in 0 ms
panic: unknown component: "archetypes"

goroutine 86 [running]:
github.com/gohugoio/hugo/hugolib.(*HugoSites).processPartial.func3(0xc0005e4070?, 0x1?, 0x0)
	/home/username/go/pkg/mod/github.com/gohugoio/hugo@v0.123.4/hugolib/hugo_sites_build.go:796 +0x102b
github.com/gohugoio/hugo/hugolib.(*HugoSites).processPartial(0xc000a783c0, {0x3f09838, 0x5373ee0}, {0x3f10d50?, 0xc0000dd0e0}, 0xc00130ac80, 0xc00191b740, {0xc00178a060, 0x1, 0x1})
	/home/username/go/pkg/mod/github.com/gohugoio/hugo@v0.123.4/hugolib/hugo_sites_build.go:860 +0xb69
github.com/gohugoio/hugo/hugolib.(*HugoSites).process(0xc00191b740?, {0x3f09838, 0x5373ee0}, {0x3f10d50?, 0xc0000dd0e0?}, 0xc00130ac80, 0x60?, {0xc00178a060, 0x1, 0x1})
	/home/username/go/pkg/mod/github.com/gohugoio/hugo@v0.123.4/hugolib/hugo_sites_build.go:234 +0x15d
github.com/gohugoio/hugo/hugolib.(*HugoSites).Build.func4()
	/home/username/go/pkg/mod/github.com/gohugoio/hugo@v0.123.4/hugolib/hugo_sites_build.go:141 +0xbd
github.com/gohugoio/hugo/hugolib.(*HugoSites).Build(0xc000a783c0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0}, {0xc00178a060, ...})
	/home/username/go/pkg/mod/github.com/gohugoio/hugo@v0.123.4/hugolib/hugo_sites_build.go:152 +0x65b
github.com/gohugoio/hugo/commands.(*hugoBuilder).rebuildSites(0xc0009bec80, {0xc00178a060, 0x1, 0x1})
	/home/username/go/pkg/mod/github.com/gohugoio/hugo@v0.123.4/commands/hugobuilder.go:1007 +0x19b
github.com/gohugoio/hugo/commands.(*hugoBuilder).handleEvents.func6(0xc0009bec80, 0xc000123ad0)
	/home/username/go/pkg/mod/github.com/gohugoio/hugo@v0.123.4/commands/hugobuilder.go:859 +0x9b
github.com/gohugoio/hugo/commands.(*hugoBuilder).handleEvents(0xc0009bec80, 0xc000843500, 0xc00083a498, {0xc000590048, 0x1, 0x1}, 0x0?)
	/home/username/go/pkg/mod/github.com/gohugoio/hugo@v0.123.4/commands/hugobuilder.go:862 +0x13bf
github.com/gohugoio/hugo/commands.(*hugoBuilder).newWatcher.func2()
	/home/username/go/pkg/mod/github.com/gohugoio/hugo@v0.123.4/commands/hugobuilder.go:347 +0x25d
created by github.com/gohugoio/hugo/commands.(*hugoBuilder).newWatcher in goroutine 1
	/home/username/go/pkg/mod/github.com/gohugoio/hugo@v0.123.4/commands/hugobuilder.go:338 +0x4f0
error Command failed with exit code 2.

I didn't have this issue when I was running the prebuilt Hugo. That was version 0.111.3.

Steps to Reproduce

  1. Install the Hugo version mentioned.
  2. Setup hugo config into "divided" yml files (see the uploaded zip file) under /config/_default config.zip. It includes:
    • config.yml
    • menus.yml
    • params.yml
    • security.yml
    • taxonomies.yml
  3. Setup some basic content. My project dir structure is provided above to help improve reproducability.
  4. Startup Hugo Server using the following command (these are the options I'm using): hugo serve -D -E -F --gc --disableFastRender --cleanDestinationDir --noHTTPCache --poll 1000ms
  5. Edit the /archetypes/default.md file - what I did was the following simple text change - from single space in the " " title replace function to two spaces, " ":
    • from: title: {{ replace .Name "-" " " | title }}
    • to: title: {{ replace .Name "-" " " | title }}
  6. The server should crash at this point.

Things I've Tried to Do

  • I've deleted all archetype files including /archetypes/default.md and made an edit to a regular Page MD file and this works - hugo server does not crash anymore.
  • If I put back the default.md file and update other content (like the /content/privacy-policy.md file), the server continues to work as expected.
  • If I edit the /archtetypes/default.md file (as described in the Reproduction section above), then the server crashes.

This is not a really critical bug as far as I can tell, more of an inconvenience. I'm still testing things out though - I tried running hugo new artwork/some-new-art/index.md and this works properly AND, if hugo server ... is running in a second terminal, it still doesn't crash. The only thing that is making hugo server crash is actually making any sort of edit to an archetype file.

Here are my two archetype files:

Please let me know if any other assistance/info is needed. Thanks!

@jmooring jmooring changed the title Hugo server command crashes when any change made to any file in /archetypes directory. Error panic: unknown component: "archetypes". Server panics when archetype is modified Mar 2, 2024
@jmooring
Copy link
Member

jmooring commented Mar 2, 2024

Summary...

hugo new site foo
cd foo
hugo server

In another terminal

echo "foo" >> archetypes/default.md

This was not a problem with v0.122.0. Fails with v0.123.0 and later.

Copy link

github-actions bot commented Apr 4, 2024

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants