---
title: "U0101: Unexpected token"
url: https://una-lang.org/en/docs/errors/U0101/
release: v0.4.0
source: https://github.com/una-lang/una/blob/v0.4.0/crates/una-explain/explain/U0101.md
---

# U0101: Unexpected token

The parser found a token that the grammar of `spec/02` does not allow at that point. The message names the token found and what was expected. After the error, parsing resumes at the next declaration, so the rest of the file is still checked.

## Why Una rejects it

U0101 also reports:

- brackets left unbalanced within a declaration,
- chained comparisons such as `a < b < c` (`spec/01 §7`),
- keywords such as `if` used as names,
- nested patterns such as `is Some(Circle(radius))`, which no edition supports,
- literal patterns such as `is Some(0)`,
- nesting deeper than 256 levels, where each chained operator counts as one level (ADR 0019).

## How to fix it

- For a nested pattern such as `is Some(Circle(radius))`, bind the field to a name, then match that name in a second `when` inside the arm.
- For a literal pattern such as `is Some(0)`, bind the field to a name, then match it in a second `when` with a literal arm and `else`, or compare it inside the arm.

## The repair at a glance

```diff
  module demo

- pub between(x: Int) -> Bool = 0 < x < 10
+ pub between(x: Int) -> Bool = 0 < x and x < 10
```

## Failing example

```una
module demo

pub between(x: Int) -> Bool = 0 < x < 10
```

## Fixed example

```una
module demo

pub between(x: Int) -> Bool = 0 < x and x < 10
```
