# `File.LinkError`
[🔗](https://github.com/elixir-lang/elixir/blob/v1.20.0-rc.3/lib/elixir/lib/exception.ex#L2476)

An exception that is raised when linking a file fails.

For example, this exception is raised when trying to link to file that isn't present:

    iex> File.ln!("existing.txt", "link.txt")
    ** (File.LinkError) could not create hard link from "link.txt" to "existing.txt": no such file or directory

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

  * `:existing` (`t:Path.t/0`) - the existing file to link
  * `:new` (`t:Path.t/0`) - the link destination
  * `:reason` (`t:File.posix/0`) - the reason why the file could not be linked

---

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