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

BUG IN HUGO v0.53+: panic: BUG: Expected valid escape code after \, but got 'W' #852

Open
andrewufrank opened this Issue Dec 25, 2018 · 7 comments

Comments

Projects
None yet
6 participants
@andrewufrank
Copy link

andrewufrank commented Dec 25, 2018

I am new to hugo and follow the instructions with hugo version Hugo Static Site Generator v0.53-8FC339DC2529FF77E494A1C12CD1FF9FBCB880A4 linux/amd64 BuildDate: 2018-12-24T08:26:10Z.

when I copy the config.toml file from the example to the main dir of my new site and run the server i get panic: bug. what am I doing wrong?

The full error msg is:

 [recovered]
	panic: BUG: Expected valid escape code after \, but got 'W'.

goroutine 1 [running]:
github.com/BurntSushi/toml.parse.func1(0xc0003af008)
	/go/pkg/mod/github.com/!burnt!sushi/toml@v0.0.0-20170626110600-a368813c5e64/parse.go:46 +0x10c
panic(0xdefd80, 0xc00024df00)
	/usr/local/go/src/runtime/panic.go:513 +0x1b9
github.com/BurntSushi/toml.(*parser).bug(0xc000158850, 0xf90ac0, 0x2f, 0xc0003aeb28, 0x1, 0x1)
	/go/pkg/mod/github.com/!burnt!sushi/toml@v0.0.0-20170626110600-a368813c5e64/parse.go:83 +0xfb
github.com/BurntSushi/toml.(*parser).replaceEscapes(0xc000158850, 0xc000040661, 0x5a, 0x5b, 0x43)
	/go/pkg/mod/github.com/!burnt!sushi/toml@v0.0.0-20170626110600-a368813c5e64/parse.go:534 +0x2d8
github.com/BurntSushi/toml.(*parser).value(0xc000158850, 0x6, 0xc000123959, 0x63, 0x48, 0xc000123947, 0xc, 0x101, 0xc0003aeee8)
	/go/pkg/mod/github.com/!burnt!sushi/toml@v0.0.0-20170626110600-a368813c5e64/parse.go:167 +0x1c7e
github.com/BurntSushi/toml.(*parser).topLevel(0xc000158850, 0x12, 0xc000123000, 0x0, 0x44)
	/go/pkg/mod/github.com/!burnt!sushi/toml@v0.0.0-20170626110600-a368813c5e64/parse.go:134 +0x7a3
github.com/BurntSushi/toml.parse(0xc000123000, 0x2c49, 0xc000158850, 0x115dba0, 0x18c02a0)
	/go/pkg/mod/github.com/!burnt!sushi/toml@v0.0.0-20170626110600-a368813c5e64/parse.go:62 +0x23e
github.com/BurntSushi/toml.Decode(0xc000123000, 0x2c49, 0xdd5a20, 0xc0003401e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/go/pkg/mod/github.com/!burnt!sushi/toml@v0.0.0-20170626110600-a368813c5e64/decode.go:115 +0x22a
github.com/BurntSushi/toml.Unmarshal(0xc000120000, 0x2c49, 0x2e49, 0xdd5a20, 0xc0003401e0, 0x0, 0xc0000651e0)
	/go/pkg/mod/github.com/!burnt!sushi/toml@v0.0.0-20170626110600-a368813c5e64/decode.go:25 +0x8a
github.com/gohugoio/hugo/parser/metadecoders.Decoder.unmarshal(0x2c, 0xc000120000, 0x2c49, 0x2e49, 0xf24fa6, 0x4, 0xdd5a20, 0xc0003401e0, 0x2c49, 0x1174440)
	/root/project/hugo/parser/metadecoders/decoder.go:122 +0x6cb
github.com/gohugoio/hugo/parser/metadecoders.Decoder.UnmarshalToMap(0x2c, 0xc000120000, 0x2c49, 0x2e49, 0xf24fa6, 0x4, 0x2e49, 0x0, 0x0)
	/root/project/hugo/parser/metadecoders/decoder.go:64 +0xc2
github.com/gohugoio/hugo/parser/metadecoders.Decoder.UnmarshalFileToMap(0x2c, 0x11738c0, 0x18bef40, 0xc0004a0040, 0x31, 0x0, 0x0, 0xc0000653c8)
	/root/project/hugo/parser/metadecoders/decoder.go:81 +0x11b
github.com/gohugoio/hugo/config.loadConfigFromFile(0x11738c0, 0x18bef40, 0xc0004a0040, 0x31, 0x1, 0x0, 0x0)
	/root/project/hugo/config/configLoader.go:72 +0x59
github.com/gohugoio/hugo/config.FromFileToMap(0x11738c0, 0x18bef40, 0xc0004a0040, 0x31, 0x1, 0x0, 0x0)
	/root/project/hugo/config/configLoader.go:56 +0x49
github.com/gohugoio/hugo/hugolib.configLoader.loadConfig(0x11738c0, 0x18bef40, 0x0, 0x0, 0xc000038064, 0x25, 0xc000038064, 0x25, 0xc0004aa060, 0x2c, ...)
	/root/project/hugo/hugolib/config.go:220 +0x243
github.com/gohugoio/hugo/hugolib.LoadConfig(0x11738c0, 0x18bef40, 0x0, 0x0, 0xc000038064, 0x25, 0xc000038064, 0x25, 0xc0004aa060, 0x2c, ...)
	/root/project/hugo/hugolib/config.go:131 +0x32f
github.com/gohugoio/hugo/commands.(*commandeer).loadConfig(0xc0001180c0, 0xc000390101, 0x115d640, 0xc00000c018)
	/root/project/hugo/commands/commandeer.go:278 +0x3be
github.com/gohugoio/hugo/commands.newCommandeer(0xc000460101, 0xc000473100, 0x115ca80, 0xc0004701c0, 0xc00046f640, 0x0, 0x0, 0x0, 0xc000420280, 0x1, ...)
	/root/project/hugo/commands/commandeer.go:160 +0x193
github.com/gohugoio/hugo/commands.initializeConfig(0x101, 0xc000473100, 0x115ca80, 0xc0004701c0, 0xc00046f640, 0x0, 0x0, 0xc000065b78)
	/root/project/hugo/commands/hugo.go:120 +0x76
github.com/gohugoio/hugo/commands.(*serverCmd).server(0xc0004701c0, 0xc000145180, 0xc00046b450, 0x0, 0x1, 0x0, 0x0)
	/root/project/hugo/commands/server.go:238 +0x1c7
github.com/gohugoio/hugo/commands.(*serverCmd).server-fm(0xc000145180, 0xc00046b450, 0x0, 0x1, 0x0, 0x0)
	/root/project/hugo/commands/server.go:88 +0x52
github.com/spf13/cobra.(*Command).execute(0xc000145180, 0xc00046b350, 0x1, 0x1, 0xc000145180, 0xc00046b350)
	/go/pkg/mod/github.com/spf13/cobra@v0.0.3/command.go:762 +0x473
github.com/spf13/cobra.(*Command).ExecuteC(0xc000439900, 0xc00046afd0, 0xc000132820, 0x0)
	/go/pkg/mod/github.com/spf13/cobra@v0.0.3/command.go:852 +0x2fd
github.com/gohugoio/hugo/commands.Execute(0xc00002e0a0, 0x2, 0x2, 0x8, 0xc000065f88, 0x4054f0, 0xc0000400b8)
	/root/project/hugo/commands/hugo.go:86 +0xad

Workaround

Jump to the workaround

@andrewufrank

This comment has been minimized.

Copy link

andrewufrank commented Dec 25, 2018

The problem seem to disappear after I edited the 'config.toml' file with my values and commented out some others.

@prateekkumarweb

This comment has been minimized.

Copy link
Contributor

prateekkumarweb commented Dec 26, 2018

Looks like there is an error while parsing your config.toml file.
Can you share your config.toml file?

Also, this is the most up to date documentation.

@rohun-tripathi

This comment has been minimized.

Copy link

rohun-tripathi commented Dec 26, 2018

This config file reports the same issue.
Commenting the following text (69-71) in the contact widget solves this -

Monday 10:00 to 13:00\
Wednesday 09:00 to 10:00\
Otherwise email to book an appointment

config.txt

@prateekkumarweb

This comment has been minimized.

Copy link
Contributor

prateekkumarweb commented Dec 26, 2018

I think it is because of a bug in the toml parser and appears to be in Hugo v0.53.

For workaround use <br> instead of \\:

  office_hours = """
  Monday 10:00 to 13:00<br>
  Wednesday 09:00 to 10:00<br>
  Otherwise email to book an appointment
  """

@gcushen gcushen changed the title /home/frank/Desktop/webTests/hugoACAF/themes/academic/exampleSite/config.toml panic: BUG: Expected valid escape code after \, but got 'W' Dec 27, 2018

@gcushen gcushen added the upstream label Dec 27, 2018

@gcushen gcushen changed the title panic: BUG: Expected valid escape code after \, but got 'W' BUG IN HUGO v0.53+: panic: BUG: Expected valid escape code after \, but got 'W' Dec 27, 2018

@gcushen

This comment has been minimized.

Copy link
Owner

gcushen commented Dec 27, 2018

This is a known bug in Hugo v0.53.

Until Hugo team revert back to an earlier TOML dependency or TOML team fix the bug, the workaround is as @prateekkumarweb posted (#852 (comment)) or to downgrade Hugo (Hugo v0.50 works fine).

Also, if this affects you, upvote the bug report at BurntSushi/toml#237

gcushen added a commit that referenced this issue Dec 28, 2018

@lukalafaye

This comment has been minimized.

Copy link

lukalafaye commented Dec 28, 2018

I tried replacing the \ with <br> but that didn't work, then removed """ and used single quotations on one line, still gave the same error Expected valid escape code after , but got 'W'
I switched to hugo v0.50 and it solved the problem, see https://github.com/gohugoio/hugo/releases/tag/v0.50
Hope that helps for those who encounter the same error!

@jhabdas

This comment has been minimized.

Copy link

jhabdas commented Jan 11, 2019

Based on a comment in gohugoio/hugoThemes#531 it appears as though Hugo may be removing some themes which don't build under 0.53 in the "in the next 30 days".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment