---
title: "U2002: Unknown or ill-formed type"
url: https://una-lang.org/en/docs/errors/U2002/
release: v0.4.0
source: https://github.com/una-lang/una/blob/v0.4.0/crates/una-explain/explain/U2002.md
---

# U2002: Unknown or ill-formed type

U2002 reports a written type that is unknown or ill-formed.

## Why Una rejects it

A written type names a built-in type, a kind or a type parameter (`spec/03`). U2002 reports:

- a name that denotes something else, such as a variant or a capability;
- range sugar on a type other than `Int`;
- a `fails` clause that names anything but a sum kind without type parameters;
- an alias defined in terms of itself;
- a record or sum kind that contains itself other than through `List` or `Option` fields, since every value must be finite (`spec/03 §2` rule 5).

A refined kind or a range written as a type argument, as `List[Pos]`, is U2002 in editions `0.1` and `0.2` (ADR 0040). Edition `0.3` accepts it and proves the refinement of every element where values are built (ADR 0103).

## How to fix it

For a recursive field, the diagnostic carries an edit that makes the field optional.

## The repair at a glance

```diff
  module demo

  pub kind Node
    value: Int
-   next: Node
+   next: Option[Node]
```

## Failing example

```una
module demo

pub kind Node
  value: Int
  next: Node
```

## Fixed example

```una
module demo

pub kind Node
  value: Int
  next: Option[Node]
```
