{"record":{"id":"792db7ec0414e658","repo":"badges/shields","slug":"unknown","errorCode":null,"errorMessage":"unknown","messagePattern":"unknown","errorType":"exception","errorClass":"NotFound","httpStatus":404,"severity":"info","filePath":"services/crates/crates-msrv.service.js","lineNumber":59,"sourceCode":"            example: 'serde',\n          },\n          {\n            name: 'version',\n            example: '1.0.194',\n          },\n        ),\n      },\n    },\n  }\n\n  static _cacheLength = 3600 // We're hitting the API more frequently than requested by upstream maintainers (see https://github.com/badges/shields/issues/11879).\n\n  static defaultBadgeData = { label: 'msrv', color: 'blue' }\n\n  static transform(response) {\n    const msrv = this.getVersionObj(response).rust_version\n    if (!msrv) {\n      throw new NotFound({ prettyMessage: 'unknown' })\n    }\n\n    return { msrv }\n  }\n\n  async handle({ crate, version }) {\n    const json = await this.fetch({ crate, version })\n    const { msrv } = this.constructor.transform(json)\n    return { message: msrv }\n  }\n}\n","sourceCodeStart":41,"sourceCodeEnd":71,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/crates/crates-msrv.service.js#L41-L71","documentation":"The crates.io MSRV badge service throws NotFound with prettyMessage 'unknown' in CratesMsrv.transform when the version object from the crates.io API has no `rust_version` field. `rust_version` (the Minimum Supported Rust Version) is optional metadata, so its absence means the crate version never declared an MSRV.","triggerScenarios":"Requesting an msrv badge for a crate or version whose Cargo.toml did not declare `rust-version`, so crates.io returns no `rust_version` for that version.","commonSituations":"Crates published before the rust-version field existed (pre-Rust 1.56 era); crates that simply never set rust-version; querying old versions of a crate that only recently added MSRV.","solutions":["Check whether the crate version actually declares rust-version in its Cargo.toml; if not, 'unknown' is the correct answer","Badge the latest version instead of an older one that predates MSRV support","If you maintain the crate, add `rust-version = \"1.x\"` to Cargo.toml and publish a new version","If you need a value anyway, use another badge or compute MSRV yourself rather than the msrv badge"],"exampleFix":"// before\n# Cargo.toml (no MSRV) -> badge shows \"unknown\"\n// after\n[package]\nrust-version = \"1.70.0\"","handlingStrategy":"fallback","validationCode":"async function hasMsrv(crate, version) {\n  const res = await fetch(`https://crates.io/api/v1/crates/${crate}${version ? '/' + version : ''}`)\n  const data = await res.json()\n  const v = version ? data.versions?.find(x => x.num === version) : data.versions?.[0]\n  return v?.rust_version != null\n}","typeGuard":"function hasMsrv(v) {\n  return typeof v?.rust_version === 'string' && v.rust_version.length > 0\n}","tryCatchPattern":"try {\n  msrv = await getCratesMsrvBadge(crate, version)\n} catch (err) {\n  if (err.prettyMessage === 'unknown') {\n    msrv = 'MSRV not declared'\n  } else throw err\n}","preventionTips":["Check the crate's Cargo.toml for rust-version before requesting the msrv badge","Badge the latest version, which is more likely to declare an MSRV","For your own crates, always set rust-version in [package]","Treat 'unknown' as expected output for pre-1.56-era crates, not a bug"],"tags":["crates-io","msrv","rust","missing-metadata"],"backgroundTag":"missing-msrv-metadata","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}