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

Can't render page on fresh installation "The filename, directory name, or volume label syntax is incorrect." #166

Open
josephbadow opened this issue Jan 9, 2024 · 4 comments · May be fixed by #181

Comments

@josephbadow
Copy link

I wanted to give this theme a spin and ran straight into an error. To make sure it's not my hugo setup I started from scratch in a different folder, but ran into the same issue.

  1. cd into C:\Users\Joseph\Gitlab
  2. hugo new site test-poison
  3. git clone https://github.com/lukeorth/poison.git themes/poison --depth=1
  4. Copy example config from https://poison.lukeorth.com/posts/introducing-poison/#example-config into hugo.toml
  5. hugo serve
Watching for changes in C:\Users\Joseph\Gitlab\test-poison\{archetypes,assets,content,data,i18n,layouts,static,themes}
Watching for config changes in C:\Users\Joseph\Gitlab\test-poison\hugo.toml, C:\Users\Joseph\Gitlab\test-poison\themes\poison\config.toml
Start building sites …
hugo v0.121.2-6d5b44305eaa9d0a157946492a6f319da38de154+extended windows/amd64 BuildDate=2024-01-05T12:21:15Z VendorInfo=gohugoio

ERROR render of "taxonomy" failed: "C:\Users\Joseph\Gitlab\test-poison\themes\poison\layouts\_default\baseof.html:1:3": execute of template failed: template: _default/list.html:1:3: executing "_default/list.html" at <partial "head/head.html" .>: error calling partial: "C:\Users\Joseph\Gitlab\test-poison\themes\poison\layouts\partials\head\head.html:16:7": execute of template failed: template: partials/head/head.html:16:7: executing "partials/head/head.html" at <partial "head/meta.html" .>: error calling partial: "C:\Users\Joseph\Gitlab\test-poison\themes\poison\layouts\partials\head\meta.html:31:6": execute of template failed: template: partials/head/meta.html:31:6: executing "partials/head/meta.html" at <fileExists $image_path_local>: error calling fileExists: CreateFile C:\Users\Joseph\Gitlab\test-poison\assets\%!!(MISSING)s(<nil>): The filename, directory name, or volume label syntax is incorrect.
ERROR render of "home" failed: "C:\Users\Joseph\Gitlab\test-poison\themes\poison\layouts\_default\baseof.html:1:3": execute of template failed: template: index.html:1:3: executing "index.html" at <partial "head/head.html" .>: error calling partial: "C:\Users\Joseph\Gitlab\test-poison\themes\poison\layouts\partials\head\head.html:16:7": execute of template failed: template: partials/head/head.html:16:7: executing "partials/head/head.html" at <partial "head/meta.html" .>: error calling partial: "C:\Users\Joseph\Gitlab\test-poison\themes\poison\layouts\partials\head\meta.html:31:6": execute of template failed: template: partials/head/meta.html:31:6: executing "partials/head/meta.html" at <fileExists $image_path_local>: error calling fileExists: CreateFile C:\Users\Joseph\Gitlab\test-poison\assets\%!!(MISSING)s(<nil>): The filename, directory name, or volume label syntax is incorrect.
Built in 73 ms
Error: error building site: render: failed to render pages: render of "taxonomy" failed: "C:\Users\Joseph\Gitlab\test-poison\themes\poison\layouts\_default\baseof.html:1:3": execute of template failed: template: _default/list.html:1:3: executing "_default/list.html" at <partial "head/head.html" .>: error calling partial: "C:\Users\Joseph\Gitlab\test-poison\themes\poison\layouts\partials\head\head.html:16:7": execute of template failed: template: partials/head/head.html:16:7: executing "partials/head/head.html" at <partial "head/meta.html" .>: error calling partial: "C:\Users\Joseph\Gitlab\test-poison\themes\poison\layouts\partials\head\meta.html:31:6": execute of template failed: template: partials/head/meta.html:31:6: executing "partials/head/meta.html" at <fileExists $image_path_local>: error calling fileExists: CreateFile C:\Users\Joseph\Gitlab\test-poison\assets\%!s(<nil>): The filename, directory name, or volume label syntax is incorrect.

I have a feeling that this could be a issue with windows path using \ instead of / on unix systems. Maybe it's also related to #148.

@josephbadow
Copy link
Author

Upon further inspection it seems that line 29 on partials/head/meta.html is causing trouble.

{{ $image_path_local :=  printf "assets/%s" $image_path -}}

It generates filepath like this

ERROR render of "taxonomy" failed [...] assets\%!!(MISSING)s(<nil>)
ERROR render of "home" failed [...] assets\%!!(MISSING)s(<nil>)
Error: error building site: render: failed to render pages: render of "taxonomy" failed [...] assets\%!s(<nil>)

But I have no idea how to write Hugo themes so maybe I'm completely on the wrong track 😅

(Just to be sure I also created a new post and set draft to false.)

@josephbadow
Copy link
Author

Just for reference, I installed Hugo into WSL (Ubuntu 22.04) and started it from the same folder:

/mnt/c/Users/Joseph/Gitlab/blog.bdw.li$ hugo serve
Watching for changes in /mnt/c/Users/Joseph/Gitlab/blog.bdw.li/{archetypes,assets,content,static,themes}
Watching for config changes in /mnt/c/Users/Joseph/Gitlab/blog.bdw.li/hugo.toml, /mnt/c/Users/Joseph/Gitlab/blog.bdw.li/themes/poison/config.toml
Start building sites …
hugo v0.121.2-6d5b44305eaa9d0a157946492a6f319da38de154+extended linux/amd64 BuildDate=2024-01-05T12:21:15Z VendorInfo=snap:0.121.2


                   | EN
-------------------+------
  Pages            | 136
  Paginator pages  |  12
  Non-page files   |   0
  Static files     | 367
  Processed images |   0
  Aliases          |   2
  Sitemaps         |   1
  Cleaned          |   0

Built in 7524 ms
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at //localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop

As you can see, no issues at all.

@istern
Copy link

istern commented Mar 5, 2024

You can also try and og_image to the default params section worked for me change to mathcing image for you
[params]
og_image = "tn.jpg"

@dbdness
Copy link

dbdness commented May 1, 2024

I experienced the same on my Windows PC, and this theme is simply too good to skip, so I dived into the issue today and found the fix. I have opened a PR here: #181.

Simplest workaround until the PR is merged: Remove the comment and provide any (non-empty) value for og_image in hugo.toml/config.toml, as @istern also mentioned. Preferably a proper social icon, but the following will also fix the build:

og_image = "n/a"

Full explanation: This is definitely the same error as described in #148, and the problem is that the meta.html partial performs a fileExists call on the $image_path_local := printf "assets/%s" $image_path -}} variable, where $image_path is defined as
{{ $image_path := .Params.image | default .Site.Params.og_image -}}.

Since the example config.toml comments out the og_image = "" param and there are no global front matter fields with key image, the image_path_local variable defaults to the following file path string: "\assets\%!s(<nil>)".

Since this path is illegal on Windows due to the percent sign, but not on Unix-based systems, only Windows users experience this error on build.

dbdness added a commit to dbdness/dannys-poison that referenced this issue May 21, 2024
* Guard meta.html fileExists call behind $image_path nil check

* Correct if and with  indentions for better readability
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants