<@ULVA73B9P> I'm trying to update the configuratio...
# ask-marvin
l
@Marvin I'm trying to update the configuration of my prefect kubernetes workers using the base-job-template.json obtained by
prefect work-pool get-default-base-job-template --type kubernetes > base-job-template.json
. However the update (
prefect work-pool update k8s-pool --base-job-template .\base-job-template.json
) fails with the following error although the file is a valid json:
Copy code
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
An exception occurred.
m
thought for 62.4 seconds
Thanks for the details — this is a common gotcha on Windows/PowerShell. What’s happening - When you use PowerShell’s
>
redirection, it can write the file with an encoding (often UTF-16) that doesn’t parse cleanly when Prefect reads it as JSON, leading to
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
. - It can also silently produce an empty file if something went wrong upstream, which triggers the same error. Two easy fixes 1) Generate the file using the built-in
--file
flag (recommended) This avoids shell redirection and writes the correct encoding.
Copy code
prefect work-pool get-default-base-job-template --type kubernetes --file base-job-template.json
prefect work-pool update k8s-pool --base-job-template .\base-job-template.json
2) If you already have a file, re-save it as UTF-8 In PowerShell:
Copy code
Get-Content .\base-job-template.json | Set-Content -Encoding utf8 .\base-job-template-utf8.json
prefect work-pool update k8s-pool --base-job-template .\base-job-template-utf8.json
Quick checks - Ensure the file isn’t empty:
Copy code
Get-Content -Head 1 .\base-job-template.json
- You can validate it parses as JSON:
Copy code
python -c "import json,sys; json.load(open('base-job-template.json', encoding='utf-8')); print('OK')"
If that still errors, please let me know: - Which shell/OS you’re using (PowerShell, CMD, Bash, etc.) - Whether
prefect work-pool get-default-base-job-template --type kubernetes
prints JSON directly in your terminal - The first few non-sensitive characters of the file (e.g., does it start with
{
) For reference, the CLI has a
--file
option specifically for this use case:
Copy code
prefect work-pool get-default-base-job-template --help
Shows: -
--file  -f TEXT  If set, write the output to a file.
Once the file is UTF-8 JSON,
prefect work-pool update
should accept it without issue.
l
@Marvin That'correct! Do i need to restart the workers after the update?
m
thought for 68.8 seconds
Short answer: No restart needed. In Prefect 3.x, workers fetch the base job template from the API at job submission time. After you update the work pool’s base-job-template, any new flow runs the worker picks up will use the updated template automatically. Already-running or already-submitted runs won’t be affected. You would only need to restart the worker if you changed something about how the worker process itself runs or authenticates (e.g., its environment variables, kubeconfig, or Python environment), since those are loaded when the worker starts. Quick sanity check:
Copy code
prefect deployment run <FLOW_NAME>/<DEPLOYMENT_NAME> --watch
Then inspect the created Kubernetes Job to confirm it reflects your changes (image, env, resources, etc.). Background on the workers model in Prefect 3.x: Prefect 3 GA