Closed deining closed 2 years ago
This is an upstream issue. I will update the TOML library; if that doesn't work, please file an issue at https://github.com/pelletier/go-toml/issues
See #9439
With v0.92.0 I am unable to reproduce the panic as described.
git clone --single-branch -b hugo-github-issue-9417 https://github.com/jmooring/hugo-testing hugo-github-issue-9417
cd hugo-github-issue-9417
cd test-site
hugo server
Error: "/home/jmooring/temp/hugo-github-issue-9417/test-module/config.toml:1:3": unmarshal failed: toml: expected character U+005D
With v0.92.0 I am unable to reproduce the panic as described.
Inside your file test-module/config.toml
there is a newline at the end of the first line. Remove this newline so that you have one single line only, and you will be confronted with the panic.
I updated my post so that this gets reflected.
@deining I updated the example and can reproduce the problem. The fact that your invalid config.toml file exists in a module is irrelevant. The panic occurs when unmarshaling any TOML file where the last line[^1] contains an incomplete key (example: [params
) and does not end with a newline.
[^1]: I use the term "line" loosely because, by POSIX standards, it isn't a line. See definition.
@bep I confirm that this is resolved with https://github.com/gohugoio/hugo/pull/9440. No panic, and the error is:
unmarshal failed: toml: expected character ] but the document ended here
@deining I updated the example and can reproduce the problem.
Great.
The fact that your invalid config.toml file exists in a module is irrelevant.
You are right. I updated my initial post with instructions how to reproduce the problem quickly.
@bep I confirm that this is resolved with #9440. No panic, and the error is:
unmarshal failed: toml: expected character ] but the document ended here
Glad to see that the issue was fixed upstream already.
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.
What version of Hugo are you using (
hugo version
)?Does this issue reproduce with the latest release?
Yes.
How to reproduce
At your command prompt, issue the following commands:
Now, hugo panics: