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.
[ERROR] cdktf get failed: could not download provider "aws" version "~> 5.0":
failed to query available provider packagesCommon 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
- Add an explicit
cdktf getstep (ornpm run get) before synth/deploy. - Verify the provider names and version constraints in cdktf.json resolve.
- Re-run so generated bindings exist.
- run: npm ci
- run: npx cdktf get
- run: npx cdktf deploy --auto-approveFix the provider constraint
Correct the version range in cdktf.json so the provider exists in the registry, and provide credentials for private providers.
{
"language": "typescript",
"terraformProviders": ["aws@~> 5.0"]
}How to prevent it
- Run
cdktf getas a build step before synth/deploy. - Pin provider versions that exist in the registry.
- Cache the generated
.genoutput between runs.