erlang
Erlang Error Reasons
Exit reasons and error class reasons used by the Erlang/OTP BEAM virtual machine, representing atoms and terms passed to exit signals, error exceptions, and throw values.
35 codes
· All codes 35 codes
- aborted aborted A Mnesia transaction or operation was aborted before completing. The full reason is typically `{aborted, Reason}` where `Reason` describes the cause of the abort.
- already_started already_started An OTP behaviour process (such as a gen_server) was started but a process with the given registered name already exists. Returned as `{error, {already_started, Pid}}`.
- bad_return_value bad_return_value An OTP behaviour callback returned a value that does not conform to the expected return type. The offending value is included as `{bad_return_value, Value}`.
- badarg badarg A built-in function or guard was called with an argument of the wrong type or an otherwise invalid value. This is the most common error reason in Erlang programs.
- badarith badarith An arithmetic expression evaluated to an error, such as division by zero or an arithmetic operation on a non-numeric term.
- badarity badarity A fun (anonymous function) was called with the wrong number of arguments. The reason term includes the fun and the argument list as `{badarity, {Fun, Args}}`.
- badfun badfun An attempt was made to call a value as a fun (anonymous function) when it is not a callable fun term. The offending value is included as `{badfun, Value}`.
- badkey badkey A map operation was attempted with a key that does not exist in the map, such as using the `#{ key := Value }` update syntax with a missing key. The missing key is included as `{badkey, Key}`.
- badmap badmap A map operation was performed on a value that is not a map. The offending value is included as `{badmap, Value}`.
- badmatch badmatch A pattern match failed; the value on the right-hand side of a match operator did not conform to the pattern on the left-hand side. The failing value is included in the reason term as `{badmatch, Value}`.
- badrecord badrecord A record operation was performed on a tuple whose first element (the record tag) does not match the expected record name. The reason term is `{badrecord, RecordTag}`.
- case_clause case_clause No branch in a `case` expression matched the value being tested. The unmatched value is included in the reason term as `{case_clause, Value}`.
- closed closed An operation was attempted on a port or socket that has already been closed. Commonly raised by port driver and gen_tcp/gen_udp operations.
- eacces eacces A file or directory operation was denied due to insufficient permissions. Corresponds to POSIX `EACCES` and is returned by `file` and network module operations.
- econnrefused econnrefused A TCP connection attempt was refused by the remote host, typically because no process is listening on the target port. Corresponds to POSIX `ECONNREFUSED`.
- einval einval An invalid argument was passed to a port driver, socket, or file operation. Corresponds to the POSIX `EINVAL` error and is surfaced by Erlang's network and I/O libraries.
- enoent enoent A file or directory referenced in a file system operation does not exist. Corresponds to POSIX `ENOENT` and is returned by `file` module operations.
- etimedout etimedout A network operation timed out at the TCP/IP level before completing. Distinct from an Erlang-level `timeout`, this corresponds to POSIX `ETIMEDOUT` and is surfaced by socket operations.
- function_clause function_clause No clause in a function matched the arguments supplied in the call. All clauses were tried and none had a matching head.
- if_clause if_clause No branch in an `if` expression evaluated to true. All guards in the `if` expression were false.
- kill kill An untrappable exit signal sent via `exit(Pid, kill)`. A process receiving this signal is unconditionally terminated; even processes trapping exits cannot catch it. The resulting exit reason becomes `killed`.
- killed killed The exit reason propagated to linked processes when a process is terminated by an untrappable `kill` signal. The BEAM runtime converts `kill` to `killed` when forwarding the signal.
- nocatch nocatch A `throw` was executed outside the scope of any enclosing `catch` expression or `try...catch` block. The thrown value is wrapped as `{nocatch, Value}`.
- noconnection noconnection A connection to a remote Erlang node could not be established or was lost during a distributed operation. Exit signals are delivered with this reason when a connected node goes down.
- noproc noproc An attempt was made to communicate with or link to a process or registered name that does not exist. Commonly raised when calling `gen_server:call/2` on a dead or non-existent process.
- normal normal A process exited normally by returning from its entry function or calling `exit(normal)`. Linked processes do not propagate exit signals with reason `normal`.
- not_owner not_owner An ETS table operation was attempted by a process that does not own or have access rights to the table. Ownership is set when the table is created.
- notalive notalive An attempt was made to perform a distributed operation, such as sending a message to a remote node, when the local node is not alive (i.e., not started as a distributed node).
- overloaded overloaded A gen_event handler returned this error to indicate it cannot handle the current load. Also used by the `error_logger` and `logger` subsystems when the event handler queue is full.
- shutdown shutdown A conventional exit reason used by OTP supervisors and applications to signal an orderly shutdown. Processes receiving `shutdown` are expected to clean up and terminate.
- stale_fun stale_fun A fun (anonymous function) that was created from an old version of a module was called after that module was reloaded. The fun's module version no longer exists in the runtime.
- system_limit system_limit A system-imposed limit was reached, such as the maximum number of processes, ports, atoms, or ETS tables. The operation that hit the limit is aborted with this error reason.
- timeout timeout A `receive` expression with an `after` clause timed out before any matching message arrived. Also used as a conventional exit reason when a process is shut down due to inactivity.
- try_clause try_clause No clause in the `of` section of a `try` expression matched the value returned by the try body. The unmatched value is included as `{try_clause, Value}`.
- undef undef A function was called that does not exist, either because the module does not export it, the module itself does not exist, or the function has the wrong arity.