Skip to content
Latchkey

cdktf "cdktf get" provider generation failed in CI

cdktf get reads cdktf.json and generates typed bindings for each provider and module. It fails when a provider cannot be downloaded from the registry or the binding generation step itself errors.

What this error means

cdktf get (or a synth that triggers it) fails with "Failed to generate constructs" or a registry download error for a provider listed in cdktf.json.

cdktf
[ERROR] cdktf get failed: could not download provider "aws" version "~> 5.0":
failed to query available provider packages

Common causes

A provider cannot be downloaded

A bad version constraint, a network/registry issue, or a private provider without credentials stops the download during get.

Generated bindings are missing or stale

CI never ran cdktf get, or the cdktf.json providers changed without regenerating, so synth has no bindings to import.

How to fix it

Run cdktf get before synth

  1. Add an explicit cdktf get step (or npm run get) before synth/deploy.
  2. Verify the provider names and version constraints in cdktf.json resolve.
  3. Re-run so generated bindings exist.
.github/workflows/ci.yml
- run: npm ci
- run: npx cdktf get
- run: npx cdktf deploy --auto-approve

Fix the provider constraint

Correct the version range in cdktf.json so the provider exists in the registry, and provide credentials for private providers.

cdktf.json
{
  "language": "typescript",
  "terraformProviders": ["aws@~> 5.0"]
}

How to prevent it

  • Run cdktf get as a build step before synth/deploy.
  • Pin provider versions that exist in the registry.
  • Cache the generated .gen output between runs.

Frequently asked questions

What causes ""cdktf get" provider failed"?
A bad version constraint, a network/registry issue, or a private provider without credentials stops the download during get.
How do I fix "cdktf get" provider failed?
Run cdktf get before synth

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card