# `Kernel.TypespecError`
[🔗](https://github.com/elixir-lang/elixir/blob/v1.20.1/lib/elixir/lib/exception.ex#L1407)

An exception raised when there's an error in a typespec.

For example, if your typespec definition points to an invalid type, you get an exception:

    @type my_type :: intger()

will raise:

    ** (Kernel.TypespecError) type intger/0 undefined

The following fields of this exceptions are public and can be accessed freely:

  * `:file` (`t:Path.t/0` or `nil`) - the file where the error occurred, or `nil` if
    the error occurred in code that did not come from a file
  * `:line` (`t:non_neg_integer/0`) - the line where the error occurred

---

*Consult [api-reference.md](api-reference.md) for complete listing*
