Skip to content

Commit b8d4db5

Browse files
committed
docs(troubleshooting): add Maven Central 429 rate-limit section
1 parent 9283eb5 commit b8d4db5

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

docs/guide/references/troubleshooting.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,25 @@ $ GITHUB_TOKEN=XXXXXXXXXX trivy image --vex repo [YOUR_IMAGE]
120120
`GITHUB_TOKEN` doesn't help with the rate limit for the vulnerability database and other assets.
121121
See https://github.com/aquasecurity/trivy/discussions/8009
122122

123+
### Maven Central rate limiting (HTTP 429)
124+
125+
When scanning Java projects, Trivy resolves transitive dependencies by downloading POM files from Maven Central (or any other configured remote Maven repository) when they are missing from the local `~/.m2` cache. Remote Maven repositories typically rate-limit per IP and return `429 Too Many Requests` once the limit is exceeded; scans of large projects with an empty local cache routinely run into this.
126+
127+
!!! error
128+
```
129+
FATAL Error remote Maven repository returned 429 Too Many Requests for https://repo.maven.apache.org/maven2/.../<artifact>-<version>.pom. Retry-After: 1800.
130+
The repository blocks all subsequent requests from this IP until the block clears.
131+
To avoid this, populate the local Maven cache before scanning (e.g. run `mvn dependency:resolve` and cache ~/.m2 in CI).
132+
```
133+
134+
The block applies to *all* subsequent requests from the affected IP for the duration indicated by `Retry-After`, regardless of whether the artifact would otherwise be served from a cache layer. The wait depends on the repository's policy — for Maven Central it is typically tens of minutes on the first violation and grows on repeat — so Trivy fails fast on the first `429` rather than retrying and risking an extended block.
135+
136+
Recommended mitigations:
137+
138+
- **Populate `~/.m2` before scanning.** Run `mvn dependency:resolve` (or any build step that resolves dependencies) so that every POM is cached locally. In CI, cache the `~/.m2` directory between runs (e.g. keyed on `pom.xml` checksums) so subsequent runs reuse the artifacts.
139+
- **Wait for the block to expire.** The `Retry-After` value in the error tells you the minimum wait. Repeated scans during the block will extend it.
140+
- **Use `--offline-scan`** to skip remote lookups entirely and rely only on the local `~/.m2` cache. Be careful: any transitive POM missing from the cache is silently skipped, so populate `~/.m2` first (see above) — otherwise the dependency tree will be incomplete.
141+
123142
### Unable to open JAR files
124143

125144
!!! error

0 commit comments

Comments
 (0)