badges/shields · error · InvalidParameter
recent downloads not supported for specific versions
Error message
recent downloads not supported for specific versions
What it means
The crates downloads service supports two variants; the 'dr' (recent downloads) variant only works for whole crates. crates.io does not expose recent download counts per version, so requesting dr with a version parameter throws InvalidParameter before any fetch.
Source
Thrown at services/crates/crates-downloads.service.js:91
}
transform({ variant, json }) {
switch (variant) {
case 'dv':
return this.constructor.getVersionObj(json).downloads
case 'dr':
return json.crate.recent_downloads || 0
default:
return json.crate ? json.crate.downloads : json.version.downloads
}
}
async handle({ variant, crate, version }) {
if (variant === 'dr' && version) {
/* crates.io doesn't currently expose
recent download counts for individual
versions */
throw new InvalidParameter({
prettyMessage: 'recent downloads not supported for specific versions',
})
}
const json = await this.fetch({ crate, version })
const downloads = this.transform({ variant, json })
return this.constructor.render({ variant, downloads, version })
}
}
View on GitHub (pinned to 766fd8bc89)
Solutions
- Drop the version segment: /crates/dr/<crate> for recent downloads of the whole crate
- Use the 'dv' variant instead: /crates/dv/<crate>/<version> for total downloads of a specific version
- Update any saved badge URLs or documentation referencing dr with a version
Example fix
// before /badge/crates/dr/serde/1.0.0 // after /badge/crates/dr/serde
Defensive patterns
Strategy: validation
Validate before calling
if (variant === 'dr' && version) throw new Error('recent downloads (dr) cannot be scoped to a version; use variant dv for per-version totals'); Try / catch
try {
const badge = await fetchBadge(`/crates/${variant}/${crate}${version ? `/${version}` : ''}`);
} catch (e) {
if (e.message.includes('recent downloads not supported')) console.warn('use /crates/dv/<crate>/<version> for per-version downloads');
else throw e;
} Prevention
- Use dr without a version for recent downloads of the whole crate
- Use dv with a version for per-version total downloads
- Never mix the dr variant with a version segment in saved URLs or docs
When it happens
Trigger: Calling the downloads badge with variant 'dr' AND a version segment, e.g. /crates/dr/<crate>/<version>.
Common situations: Users appending a version out of habit from the 'dv' (total downloads per version) badge, or copy-pasting a URL template and swapping variant letters.
Related errors
- strict ssl is required
- invalid url parameter
- requested origin not authorized
- version not found
- invalid null license
AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30).
Data as JSON: /api/errors/f6c3d43c8bcce5de.
Report an issue: GitHub.