Error calling partial: context canceled

I’ve been calling return partials from javascript scripts. Like so

const code_block_config = JSON.parse('{{ partial "functions/getCodeConfig" . }}');

This code worked well before version 0.111.0. Now, I get this error

Error: Error building site: EXECUTE-AS-TEMPLATE: 
failed to transform "js/variables.js" (text/javascript): template: js/variables.js:17:41:
 executing "js/variables.js" at <partial "functions/getCodeConfig" .>: 
error calling partial: context canceled

I looked through the release notes for 0.111.0 & 0.111.1… I couldn’t figure what changed. What could I be missing? :thinking:

We need to be able to reproduce the problem to fix it, unless @bep sees something obvious.

With a simple test as you describe, I am unable to reproduce the problem:

git clone --single-branch -b hugo-forum-topic-43260 hugo-forum-topic-43260
cd hugo-forum-topic-43260
hugo server

For different reasons (mainly to bail out of recursive partial loops), I added a timeout (defaults to 30s) in the partial func. I would, however, expect the error to say “partial timed out …” … So your error message confuses me, but it’s certainly related to that change.

Can you try to run with a higher timeout value e.g.


On an related note, I would recommend that you look into js.Build and the params option for a simpler JS setup.

1 Like

@jmooring I had linked to a theme with an exampleSite, sorry it wasn’t obvious.

Thanks, this didn’t solve the issue. I’ll try the js.Build option as you’ve recommended. I would have to refactor multiple projects though where I have used that approach. Hoping there’s another way :crossed_fingers:

Yea, that site fails for me, which is a good thing …

1 Like

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