# Cargo: error: failed to select a version for the requirement `serde = "^2.0"` — candidate versions found which didn't match: 1.0.197

**Code:** `cargo: failed to select a version for the requirement` · **Category:** Rust · **Seen on:** Rust

Cargo can't find a version of a dependency satisfying the constraints you (or other crates) set.

## Meaning

Relax or correct the version in `Cargo.toml` (`serde = "1"`), check crate name/features, and see conflicts with `cargo tree -d`. Yanked versions, MSRV (`rust-version`) limits and overly strict `=x.y.z` pins create this. `cargo update -p crate` refreshes the lockfile.

## Common causes

- Version requirement higher than published
- Conflicting requirements between dependencies
- Yanked version in Cargo.lock
- Wrong crate name or feature
- Registry index outdated/offline

## Quick fix

1. Edit Cargo.toml to an existing version (`cargo search crate`)
2. `cargo update -p crate`
3. Use `cargo tree -i crate` to see who requires what

## Detailed fix by platform

### Rust

1. `cargo search serde --limit 1 && cargo tree -i serde`

## How to diagnose

1. **Requirement** — Version exists?
2. **Conflicts** — cargo tree -d?
3. **Registry** — Reachable?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/rust/cargo-failed-to-select-a-version)
