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

An exception raised when there's an error when compiling code.

For example:

    1 = y
    ** (CompileError) iex:1: undefined variable "y"

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
  * `:description` (`t:String.t/0`) - a description of the compile error

This is mostly raised by Elixir tooling when compiling and evaluating code.

---

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