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

Changing frontmatter causes cached "Rebuild failed" error in server that persists until restart #12390

Closed
jnvsor opened this issue Apr 18, 2024 · 2 comments

Comments

@jnvsor
Copy link

jnvsor commented Apr 18, 2024

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

$ hugo version
hugo v0.125.1-68c5ad638c2072969e47262926b912e80fd71a77+extended linux/amd64 BuildDate=2024-04-18T08:21:19Z VendorInfo=gohugoio

Does this issue reproduce with the latest release?

Yes


I create a site per the quick start instructions:

hugo new site testbug
cd testbug/
git init
git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
echo "theme = 'ananke'" >> hugo.toml
hugo server

I create a small file with a yaml frontmatter:

---
title: Test
---
Change detected, rebuilding site (#1).
2024-04-18 14:51:23.022 +0200
Source changed /test.md
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Total in 3 ms

If I change the frontmatter type to toml and cause a syntax error:

+++
title: Test
+++
Change detected, rebuilding site (#2).
2024-04-18 14:51:28.022 +0200
Source changed /test.md
ERROR Rebuild failed: process: ".../testbug/content/test.md:2:6": unmarshal failed: toml: expected character =
Total in 0 ms

So far so good, only now no matter if I fix the syntax errors or switch back to the yaml delineation it continues to throw this error:

Change detected, rebuilding site (#3).
2024-04-18 14:51:33.022 +0200
Source changed /test.md
ERROR Rebuild failed: process: ".../testbug/content/test.md:2:6": unmarshal failed: toml: expected character =
Total in 0 ms

Since it shows the same line/char in the error message it's not simply a case of getting stuck on toml parsing when set back to yaml, and the site shows this error too.

Adding a new file can cause it to update showing 2 files changed:

---
title: Test 2
---
Change detected, rebuilding site (#4).
2024-04-18 14:54:45.022 +0200
Source changed /test2.md
Source changed /test.md
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Total in 1 ms

The site correctly livereloads to working order... However, if I perform the same routine with the second file and try to use the first file to trigger the update:

Change detected, rebuilding site (#5).
2024-04-18 14:55:43.022 +0200
Source changed /test2.md
ERROR Rebuild failed: process: ".../testbug/content/test2.md:2:6": unmarshal failed: toml: expected character =
Total in 0 ms

Change detected, rebuilding site (#6).
2024-04-18 14:55:45.022 +0200
Source changed /test2.md
ERROR Rebuild failed: process: ".../testbug/content/test2.md:2:6": unmarshal failed: toml: expected character =
Total in 0 ms

Change detected, rebuilding site (#7).
2024-04-18 14:55:52.522 +0200
Source changed /test.md
Source changed /test2.md
ERROR Rebuild failed: process: ".../testbug/content/test.md:2:6": unmarshal failed: toml: expected character =
Total in 0 ms

It falls back to the error it previously showed. Builds 3 6 and 7 in this example should have worked, so something seems to be cached that shouldn't be. Restarting the server clears these errors.

@jmooring
Copy link
Member

Duplicate of #11378.

Copy link

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 May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants