[SOLVED] Error calling Concat: resources in Concat must be of the same Media Type. Was working before

In v 0.123.2 i get this error that i didn’t had in previous version i used where all is working fine(at least v0.110.0 who is the production version for this code and i think v0.116.1 locally also)

error calling Concat: resources in Concat must be of the same Media Type, got "text/x-scss" and "text/css"

Error comes from line 28 in the code (.resources.Concat).
I put the full error message at the end.

{{ $styles := slice }}
{{ range site.Params.plugins.css }}
      {{ $styles = $styles | append (resources.Get .link) }}
{{ end }}

{{ $styles := $styles | append (resources.Get "scss/style.scss" | resources.ExecuteAsTemplate "style.scss" . | toCSS) }}

line 28 ==> {{ $styles = $styles | resources.Concat "/css/style.css" }}

$ hugo --gc --cleanDestinationDir  --printI18nWarnings --logLevel info  && htmltest -l 3
Start building sites … 
hugo v0.123.2-929b91fe75cb0d041f22b4707700dfc117115ad4+extended darwin/amd64 BuildDate=2024-02-22T15:27:15Z VendorInfo=brew

INFO  static: removing all files from destination that don't exist in static dirs
INFO  static: syncing static files to / duration 136.244416ms
INFO  build:  step process substep collect files 692 files_total 692 duration 814.792375ms
INFO  build:  step process duration 815.360125ms
INFO  build:  step assemble duration 15.904875ms
ERROR render of "page" failed: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/_default/baseof.html:11:7": execute of template failed: template: author/single.html:11:7: executing "author/single.html" at <partialCached "essentials/style.html" .>: error calling partialCached: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/partials/essentials/style.html:28:32": execute of template failed: template: partials/essentials/style.html:28:32: executing "partials/essentials/style.html" at <resources.Concat>: error calling Concat: resources in Concat must be of the same Media Type, got "text/x-scss" and "text/css"
ERROR render of "page" failed: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/_default/baseof.html:11:7": execute of template failed: template: _default/our-rooms.html:11:7: executing "_default/our-rooms.html" at <partialCached "essentials/style.html" .>: error calling partialCached: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/partials/essentials/style.html:28:32": execute of template failed: template: partials/essentials/style.html:28:32: executing "partials/essentials/style.html" at <resources.Concat>: error calling Concat: resources in Concat must be of the same Media Type, got "text/x-scss" and "text/css"
ERROR render of "term" failed: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/_default/baseof.html:11:7": execute of template failed: template: _default/list.html:11:7: executing "_default/list.html" at <partialCached "essentials/style.html" .>: error calling partialCached: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/partials/essentials/style.html:28:32": execute of template failed: template: partials/essentials/style.html:28:32: executing "partials/essentials/style.html" at <resources.Concat>: error calling Concat: resources in Concat must be of the same Media Type, got "text/x-scss" and "text/css"
ERROR render of "home" failed: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/_default/baseof.html:11:7": execute of template failed: template: index.html:11:7: executing "index.html" at <partialCached "essentials/style.html" .>: error calling partialCached: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/partials/essentials/style.html:28:32": execute of template failed: template: partials/essentials/style.html:28:32: executing "partials/essentials/style.html" at <resources.Concat>: error calling Concat: resources in Concat must be of the same Media Type, got "text/x-scss" and "text/css"
INFO  build:  step render pages 94 content 14 duration 308.683708ms
INFO  build:  step postProcess duration 2.848167ms
ERROR TOCSS: failed to transform "style.scss" (text/x-scss): "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/assets/scss/templates/_bootstrap.scss:3:1": File to import not found or unreadable: ../bootstrap/mixins/banner.
INFO  build:  duration 1.144290791s
Total in 1552 ms
Error: error building site: TOCSS: failed to transform "style.scss" (text/x-scss): "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/assets/scss/templates/_bootstrap.scss:3:1": File to import not found or unreadable: ../bootstrap/mixins/banner.

I am unable to reproduce the problem as described, provided I have not misconfigured the site parameters. Tested with v0.123.2.

git clone --single-branch -b hugo-forum-topic-48443 https://github.com/jmooring/hugo-testing hugo-forum-topic-48443
cd hugo-forum-topic-48443
hugo server

Works great.

I can force the error you reported by doing something stupid in site config:

[[params.plugins.css]]
name = 'a'
link = 'css/a.css'

[[params.plugins.css]]
name = 'b'
link = 'css/b.css'

[[params.plugins.css]]
name = 'c'
link = 'scss/c.scss'     <-- mixing Sass with CSS correctly triggers the error

Without access to your site I have no idea what the problem is.

Thanks for looking, Jo.

I don’t think I have made such mixin.

I just added you to the repo. You should have received an invite.

I will check again.

Mmmm i’m wondering if the first cause is this error on last line. Because this error impact the append using ToCSS, then the Concat.

But still do not understand why this error arrives now.

[EDIT] Wondering if this is related to Unable to import SCSS by relative path when using v0.123.0 - #7 by jmooring

Will look when i come home

This is fixed, will be available in v0.123.4.

See https://github.com/gohugoio/hugo/pull/12139

p.s. That’s a beautiful site.

1 Like

Hey, this is more than cool.

Thanks Joe & Bep for all your hard dedicated work & help.

PS : Thanks for the site, Jo. But the hotel himself and the surroundings are amazing.

1 Like

Confirmed solved. Testing with the latest dev version.

1 Like

Thanks for the confirmation.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.