Skip to content
Latchkey

Terraform "rpc error: code = Unavailable" provider crash in CI

A provider subprocess died during plan/apply -- a panic, an OOM kill, or a fatal bug -- so its RPC connection became Unavailable and Terraform could not continue.

What this error means

plan/apply fails with "rpc error: code = Unavailable" or "The plugin ... crashed!". It can be intermittent (memory pressure) or deterministic (a provider bug hit by specific input).

terraform
Error: Plugin did not respond

The plugin encountered an error, and failed to respond to the
plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain
more details.

Error: rpc error: code = Unavailable desc = transport is closing

Common causes

Provider crash or OOM

The plugin panicked or was killed (often memory pressure on a small runner with high parallelism), severing the RPC channel.

Provider bug on specific input

A defect in the provider version, triggered by a particular resource/config, makes it crash deterministically.

How to fix it

Retry, reduce parallelism, and check the crash log

Re-run with lower parallelism and more memory; inspect the crash log to tell transient from deterministic.

Terminal
TF_LOG=trace terraform apply -input=false -parallelism=5
# inspect the generated crash log if present:
cat crash.log 2>/dev/null | head -40

Address a deterministic crash

  1. If it crashes on the same input every time, upgrade or pin a provider version without the bug.
  2. Search the provider issue tracker for the panic signature.
  3. Reduce the blast radius with -target to isolate the offending resource while you patch.

How to prevent it

  • Give Terraform enough memory and modest parallelism for large graphs.
  • Pin provider versions and track their changelogs/known crashes.
  • Run apply on a platform that auto-retries transient provider crashes.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →