E0004: non-exhaustive patterns Rust Origin: Application & API OSI layer 7 · Application Last updated 5 Nov 2026

Rust: error[E0004]: non-exhaustive patterns: `None` not covered

A match doesn't handle every possible value of the type.

Exact message you may see error[E0004]: non-exhaustive patterns: `None` not coverednon-exhaustive patterns: `&_` not coverederror[E0004]: non-exhaustive patterns: `Err(_)` not coveredpatterns `i32::MIN..=-1_i32` and `1_i32..=i32::MAX` not coveredpattern `Foo::C` not covered
Seen on: Rust

Meaning

Add the missing arms or a catch-all _ => .... Prefer listing enum variants explicitly so new variants cause compile errors. For integers add ranges or _. if let is fine when you care about one case.

Common causes

  • Missing enum variant arm
  • Option/Result arm omitted
  • Integer range not fully covered
  • New variant added to an enum
  • Match on references missing &

⚡ Quick fix

  1. Add arms for the missing variants shown
  2. _ => unreachable!()/default when appropriate
  3. Use if let Some(x) = ... for single-case handling

Detailed fix by platform

Rust

  1. match opt { Some(v) => v, None => return Err(Error::Missing) }

How to diagnose

  1. Missing — Which patterns?
  2. Catch-all — Appropriate?
  3. if let — Enough?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

Blocking waiting for file lock on package cache / build directory — Cargo: Blocking waiting for file lock on package cache / on build directory (Rust)Blocking waiting for …cargo: failed to get from registry (spurious network error) — Cargo: warning: spurious network error (2 tries remaining): [35] SSL connect error / error: failed to download from `https://index.crates.io/...` (Rust)cargo: failed to get …cargo: failed to select a version for the requirement — Cargo: error: failed to select a version for the requirement `serde = "^2.0"` — candidate versions found which didn't match: 1.0.197 (Rust)cargo: failed to sele…E0277: the trait bound is not satisfied — Rust: error[E0277]: the trait bound `Foo: Display` is not satisfied / `Rc<RefCell<T>>` cannot be sent between threads safely (Rust)E0277: the trait boun…E0308 — Rust: error[E0308]: mismatched types — expected `X`, found `Y` (Rust)E0308E0381: used binding isn't initialized — Rust: error[E0381]: used binding `x` is possibly-uninitialized (Rust)E0381: used binding i…E0599: no method named found for type — Rust: error[E0599]: no method named `push_str` found for struct `Vec<String>` in the current scope (Rust)E0599: no method name…error: toolchain 'stable' is not installed / override toolchain not found — rustup: error: toolchain 'nightly-x86_64-unknown-linux-gnu' is not installed / error: no override and no default toolchain set (Rust)error: toolchain 'sta…E0004: no…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.