Failed to get provider versions: invalid character '<' looking for beginning of value
Fixes Terragrunt's 'Failed to get provider versions from network_mirror ... invalid character < looking for beginning of value' by stopping the provider cache server from reading the wrong CLI config. Use when terragrunt init fails this way on a machine with a stray .tofurc. Fixed in v1.1.5; upgrade or remove the stray config.
TL;DR: Terragrunt's provider cache server read the WRONG tool's CLI config (your OpenTofu ~/.tofurc while running Terraform), and the network_mirror block isn't valid JSON for the version-listing call. Upgrade to v1.1.5+, or delete/rename the stray ~/.tofurc.
ERROR Failed to get provider versions from "network_mirror '...'": invalid character '<' looking for beginning of valueSteps
- Check for the stray config:
ls -la ~/.tofurc ~/.terraformrcand inspect anynetwork_mirrorblocks.
Expected: a ~/.tofurc exists while you're running Terragrunt with Terraform (or vice versa).
- Upgrade Terragrunt to v1.1.5 or newer.
Expected: the cache server reads only the running implementation's CLI config files.
- If you can't upgrade yet: move the stray file aside (
mv ~/.tofurc ~/.tofurc.bak) when running the other implementation, or setTF_CLI_CONFIG_FILEto the right file explicitly.
Expected: terragrunt init succeeds.
When this applies
- Terragrunt 1.1.4,
terragrunt initfails withinvalid character '<'mentioningnetwork_mirror. - A
~/.tofurcor~/.terraformrcexists for the implementation you are NOT running.
When it doesn't apply
- The same
invalid character '<'from a real registry or mirror returning HTML: that's a server/proxy problem, not this bug. - Provider install 403s: registry auth issue, different fix.
Tool versions
Terragrunt v1.1.4 broken; fixed in v1.1.5. (OpenTofu reads ~/.tofurc then ~/.terraformrc; Terraform reads only ~/.terraformrc.)
Why it happens
v1.1.4's cache server unconditionally read OpenTofu's CLI config locations. A network_mirror stanza meant for tofu was then applied to Terraform provider downloads, and the version-listing request choked parsing it.
Edge cases
TF_CLI_CONFIG_FILEoverrides the config file location for both implementations, so a stale env var can reproduce the same confusion on fixed versions.*.tfrc/*.tfrc.jsonfragments in~/.terraform.dare merged for both implementations; a bad fragment there breaks both.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.