`FATAL ... failed to download vulnerability DB: ... TOOMANYREQUESTS: retry-after` from Trivy in CI
IntermediateTroubleshootingContainer image and IaC scanning
Answer
Likely causes → Every job pulls the DB from ghcr.io/aquasecurity/trivy-db anonymously and hits GHCR rate limits, especially behind a shared NAT IP.
Diagnose → Error appears in the DB download phase; count how many parallel jobs start Trivy at once.
Fix → Use a mirror and cache:
trivy image --db-repository public.ecr.aws/aquasecurity/trivy-db:2 \
--java-db-repository public.ecr.aws/aquasecurity/trivy-java-db:1 \
--cache-dir .trivycache myapp:1.4
Cache .trivycache between runs (actions/cache keyed by date).
Prevent → Mirror the DB into your own registry with a scheduled job (oras copy), point all jobs at it, and run PR scans with --skip-db-update against the cached copy.
More on Container image and IaC scanning
Trivy fails the build on 14 HIGH/CRITICAL CVEs in the base image, all with "Fixed Version" emptyBeginnerTrivy in an air-gapped runner fails with `failed to download vulnerability DB` even though you copied `db.tar.gz`AdvancedTrivy and Grype report different CVE counts for the same imageIntermediate`.trivyignore` entries are ignored and the build still fails on the same CVEBeginnerTrivy reports a critical CVE in a Go binary built from your own code, in package `stdlib`IntermediateImage scan passes in CI but the registry scanner (ECR enhanced scanning / Harbor) shows criticals a week laterBeginner