# XO0302: pattern does not fit the type of the matched value

The pattern can never match because it describes a different type: a variant of another enum, `Ok` on an optional, a literal of the wrong type, a tuple of the wrong size, a list pattern on a non list. It also covers malformed variant and struct patterns: parentheses on a variant without fields (or none on one with fields), too many or repeated fields, and fields left unmentioned without `..`. See core 3.5.

## Example

```xo
fn f(o: Int?) -> Bool {
  o is Ok(_)
}
```

## Fix

```xo
fn f(o: Int?) -> Bool {
  o is Some(_)
}
```

Run `xo explain XO0302` for this text in a terminal, or see
[section 10.6 of the specification](../../spec/core/#106-diagnostic-codes).

