Linux error codes
Look up what an errno such as ECONNREFUSED or “[Errno 13]”, a signal such as SIGKILL or an exit code such as 137 means, with the Linux and macOS values. Paste the full message from the program, Docker or Kubernetes and the tool picks out the code.
Examples:

208 of 208 codes

errnoSystem call errors151
EPERM
Linux 1macOS 1

Operation not permitted

The operation requires privileges that the process does not have, such as changing the owner of a file, sending a signal to another user's process or modifying an immutable file (chattr +i). Unlike EACCES, it is not solved by changing the file's permissions: it takes root or the corresponding capability.

ENOENT
Linux 2macOS 2

No such file or directory

The file or directory does not exist. It also appears when an intermediate directory in the path is missing, when a symbolic link points to a target that does not exist or when the interpreter in a script's #! line is not installed.

ESRCH
Linux 3macOS 3

No such process

No process, process group or thread exists with that ID; for example, when running kill on a PID that has already exited.

EINTR
Linux 4macOS 4

Interrupted system call

A signal interrupted the system call before it finished. It is not a real error: the program should retry the call, or install the signal handler with SA_RESTART.

EIO
Linux 5macOS 5

Input/output error

Low-level input/output error, usually when reading from or writing to the device. On disks it usually points to bad sectors or a faulty cable: check dmesg and the SMART status. It also appears when writing to a terminal that has already been closed.

ENXIO
Linux 6macOS 6

No such device or address

macOS: Device not configured

The device or address does not exist: the device file is there, but there is no hardware behind it, or a FIFO was opened for writing with O_NONBLOCK without any reader.

E2BIG
Linux 7macOS 7

Argument list too long

The list of arguments and environment variables passed to exec is too large. It is the classic “Argument list too long” when using a wildcard that expands to thousands of files; use find -exec or xargs.

ENOEXEC
Linux 8macOS 8

Exec format error

The file is not in a recognized executable format: it is a binary for another architecture, it is corrupted or it is a script without a #! line.

EBADF
Linux 9macOS 9

Bad file descriptor

The file descriptor is not valid, has already been closed or was opened in a mode that does not allow the operation, such as writing to one opened read-only.

ECHILD
Linux 10macOS 10

No child processes

The process has no children to wait for with wait or waitpid, often because SIGCHLD is ignored and children are reaped automatically.

EAGAIN
Linux 11macOS 35

Resource temporarily unavailable

The resource is temporarily unavailable and it is worth retrying. In non-blocking operations it means that there is no data or space yet; in fork, that the process or thread limit has been reached (ulimit -u or the cgroup's pids.max).

Same value:EWOULDBLOCK

ENOMEM
Linux 12macOS 12

Cannot allocate memory

There is not enough memory for the operation or a process memory limit was exceeded. In fork or mmap it may be due to the overcommit policy, the cgroup limit or a lack of address space.

EACCES
Linux 13macOS 13

Permission denied

Permission denied by the permissions of the file or of a directory in the path (each one needs execute permission), by an ACL, by SELinux or AppArmor, or by a noexec mount. bind also returns it when using a port below 1024 without privileges.

EFAULT
Linux 14macOS 14

Bad address

A pointer to an invalid memory address was passed to a system call. It indicates a bug in the program.

ENOTBLK
Linux 15macOS 15

Block device required

The operation needs a block device, such as a disk, and received another type of file; for example, when mounting a regular file without -o loop.

EBUSY
Linux 16macOS 16

Device or resource busy

macOS: Device / Resource busy

The device or resource is busy. It is typical when unmounting a file system that has open files or a terminal located in it; lsof or fuser show which processes are using it.

EEXIST
Linux 17macOS 17

File exists

A file, directory or other object with that name already exists, for example when creating with O_EXCL, when using mkdir without -p or when creating a link whose destination already exists.

EXDEV
Linux 18macOS 18

Invalid cross-device link

macOS: Cross-device link

A hard link cannot be created, nor a file renamed, across different file systems. mv handles it by copying and deleting; programs that use rename() must do the same.

ENODEV
Linux 19macOS 19

No such device

macOS: Operation not supported by device

The device does not exist or does not support the operation; for example, when mounting a file system type whose kernel module is not loaded.

ENOTDIR
Linux 20macOS 20

Not a directory

A component of the path that should be a directory is a file, or a directory was requested (O_DIRECTORY) and it is not one.

EISDIR
Linux 21macOS 21

Is a directory

A file operation was attempted on a directory, such as opening it for writing.

EINVAL
Linux 22macOS 22

Invalid argument

An argument is not valid for the call: a value out of range, an incompatible combination of options or an operation that the object does not support. It is generic: the call's man page lists the specific cases.

ENFILE
Linux 23macOS 23

Too many open files in system

The system-wide open file table is exhausted. The limit is adjusted with fs.file-max in sysctl.

EMFILE
Linux 24macOS 24

Too many open files

The process reached its limit of open descriptors (“Too many open files”). Raise the limit with ulimit -n or with LimitNOFILE in systemd, and check that the program is not leaving files or sockets unclosed.

ENOTTY
Linux 25macOS 25

Inappropriate ioctl for device

A terminal operation (ioctl) was requested on something that is not a terminal, for example when the output of an interactive program is redirected to a file or a pipe.

ETXTBSY
Linux 26macOS 26

Text file busy

The executable is in use: you cannot write to a binary while it is running, nor run one that is still open for writing. To update it, write a new file and rename it.

EFBIG
Linux 27macOS 27

File too large

The file exceeds the maximum size supported by the file system (4 GB on FAT32) or the process's RLIMIT_FSIZE limit.

ENOSPC
Linux 28macOS 28

No space left on device

No space left on the device. If df shows free space, check the inodes with df -i. inotify also returns it when fs.inotify.max_user_watches is exhausted.

ESPIPE
Linux 29macOS 29

Illegal seek

lseek cannot be used on a pipe, a FIFO or a socket, because they have no position.

EROFS
Linux 30macOS 30

Read-only file system

The file system is mounted read-only. If it became read-only without anyone asking for it, the kernel did it after detecting errors: check dmesg and run fsck.

EMLINK
Linux 31macOS 31

Too many links

The maximum number of hard links to a file was exceeded or, on some file systems, the maximum number of subdirectories in a directory.

EPIPE
Linux 32macOS 32

Broken pipe

Data was written to a pipe or socket whose other end has already been closed (“Broken pipe”). Besides the error, the process receives SIGPIPE; it is normal when the reader exits first, as in cmd | head.

EDOM
Linux 33macOS 33

Numerical argument out of domain

The argument of a math function is outside its domain, such as the square root of a negative number.

ERANGE
Linux 34macOS 34

Numerical result out of range

macOS: Result too large

The result of a function is too large or too small to be represented, or a buffer is not big enough for the result, as in getcwd with a short buffer.

EDEADLK
Linux 35macOS 11

Resource deadlock avoided

A deadlock was avoided: the requested lock, such as a file lock with fcntl or an error-checking mutex, would have waited forever.

Same value:EDEADLOCK

ENAMETOOLONG
Linux 36macOS 63

File name too long

The path or one of its components exceeds the maximum length: on Linux, generally 255 bytes per name and 4096 per path.

ENOLCK
Linux 37macOS 77

No locks available

No locks available. On NFS it usually means that the locking service (lockd or rpc.statd) is not running.

ENOSYS
Linux 38macOS 78

Function not implemented

The system call does not exist in this kernel or is not implemented. It is typical of binaries built for a newer kernel, or of container seccomp profiles that do not know about recent calls.

ENOTEMPTY
Linux 39macOS 66

Directory not empty

The directory is not empty, for example when using rmdir or when renaming over an existing directory. To delete it along with its contents, use rm -r.

ELOOP
Linux 40macOS 62

Too many levels of symbolic links

Too many symbolic links were chained while resolving the path, usually because of a loop, or O_NOFOLLOW was used on a symbolic link.

ENOMSG
Linux 42macOS 91

No message of desired type

There is no message of the requested type in the System V message queue.

EIDRM
Linux 43macOS 90

Identifier removed

The System V IPC identifier (queue, semaphore or shared memory) was removed while the process was using it.

ECHRNG
Linux 44macOS —

Channel number out of range

Channel number out of range. It is a legacy code with no practical use on Linux.

EL2NSYNC
Linux 45macOS —

Level 2 not synchronized

Level 2 not synchronized. It is a legacy System V code with no practical use on Linux.

EL3HLT
Linux 46macOS —

Level 3 halted

Level 3 halted. It is a legacy System V code with no practical use on Linux.

EL3RST
Linux 47macOS —

Level 3 reset

Level 3 reset. It is a legacy System V code with no practical use on Linux.

ELNRNG
Linux 48macOS —

Link number out of range

Link number out of range. It is a legacy code with no practical use on Linux.

EUNATCH
Linux 49macOS —

Protocol driver not attached

The protocol driver is not attached. Few subsystems use it, such as some Bluetooth drivers.

ENOCSI
Linux 50macOS —

No CSI structure available

No CSI structure available. It is a legacy code with no practical use on Linux.

EL2HLT
Linux 51macOS —

Level 2 halted

Level 2 halted. It is a legacy System V code with no practical use on Linux.

EBADE
Linux 52macOS —

Invalid exchange

Invalid exchange. It is a legacy code that some drivers and file systems reuse with their own meaning.

EBADR
Linux 53macOS —

Invalid request descriptor

Invalid request descriptor. It is a legacy code that some drivers reuse with their own meaning.

EXFULL
Linux 54macOS —

Exchange full

Exchange full. It is a legacy code with no practical use on Linux.

ENOANO
Linux 55macOS —

No anode

No “anode”. It is a legacy code with no practical use on Linux.

EBADRQC
Linux 56macOS —

Invalid request code

Invalid request code. It is legacy; some drivers use it for commands they do not support.

EBADSLT
Linux 57macOS —

Invalid slot

Invalid slot. It is a legacy code with no practical use on Linux.

EBFONT
Linux 59macOS —

Bad font file format

Bad font file format. It is a legacy code with no practical use on Linux.

ENOSTR
Linux 60macOS 99

Device not a stream

macOS: Not a STREAM

The device is not a STREAM. It belongs to the System V STREAMS interface, which Linux does not implement.

ENODATA
Linux 61macOS 96

No data available

macOS: No message available on STREAM

No data available. On Linux, getxattr returns it when the extended attribute does not exist; on macOS that case is ENOATTR.

ETIME
Linux 62macOS 101

Timer expired

macOS: STREAM ioctl timeout

A timer expired. It comes from STREAMS; on Linux some drivers and io_uring use it for operations with a timeout.

ENOSR
Linux 63macOS 98

Out of streams resources

macOS: No STREAM resources

Out of STREAMS resources, an interface that Linux does not implement.

ENONET
Linux 64macOS —

Machine is not on the network

The machine is not on the network. It is a rarely used legacy code.

ENOPKG
Linux 65macOS —

Package not installed

The package is not installed. It is legacy; some subsystems use it when a module is missing, for example a cryptographic one.

EREMOTE
Linux 66macOS 71

Object is remote

macOS: Too many levels of remote in path

The object is remote. On NFS it indicates a path that is exported from another server.

ENOLINK
Linux 67macOS 97

Link has been severed

The link has been severed. It is legacy; some drivers use it when the connection to the device is lost.

EADV
Linux 68macOS —

Advertise error

“Advertise” error. It is a legacy RFS code with no use on Linux.

ESRMNT
Linux 69macOS —

Srmount error

“Srmount” error. It is a legacy RFS code with no use on Linux.

ECOMM
Linux 70macOS —

Communication error on send

Communication error on send. It is legacy; some network and USB drivers use it.

EPROTO
Linux 71macOS 100

Protocol error

Protocol error: the other end or the device responded with something unexpected. It appears with USB devices and on connections that drop in the middle of an exchange.

EMULTIHOP
Linux 72macOS 95

Multihop attempted

A multihop was attempted. It is a legacy RFS code.

EDOTDOT
Linux 73macOS —

RFS specific error

RFS-specific error. Not used on Linux.

EBADMSG
Linux 74macOS 94

Bad message

The message is malformed or corrupted. ext4, XFS and Btrfs return it, under the alias EFSBADCRC, when a metadata checksum fails.

Same value:EFSBADCRC

EOVERFLOW
Linux 75macOS 84

Value too large for defined data type

macOS: Value too large to be stored in data type

The value does not fit in the target data type; for example, a 32-bit program built without large file support that opens a file larger than 2 GB.

ENOTUNIQ
Linux 76macOS —

Name not unique on network

The name is not unique on the network. It is a legacy code.

EBADFD
Linux 77macOS —

File descriptor in bad state

The file descriptor is in a bad state. ALSA and some drivers use it when the device is not ready.

EREMCHG
Linux 78macOS —

Remote address changed

The remote address changed. It is a legacy code.

ELIBACC
Linux 79macOS —

Can not access a needed shared library

A required shared library cannot be accessed. It is a legacy code from a.out binaries.

ELIBBAD
Linux 80macOS —

Accessing a corrupted shared library

The shared library is corrupted. It is a legacy code from a.out binaries.

ELIBSCN
Linux 81macOS —

.lib section in a.out corrupted

The .lib section of the a.out binary is corrupted. It is a legacy code.

ELIBMAX
Linux 82macOS —

Attempting to link in too many shared libraries

An attempt was made to link too many shared libraries. It is a legacy a.out code.

ELIBEXEC
Linux 83macOS —

Cannot exec a shared library directly

A shared library cannot be executed directly. It is a legacy a.out code.

EILSEQ
Linux 84macOS 92

Invalid or incomplete multibyte or wide character

macOS: Illegal byte sequence

The byte sequence is not valid for the character encoding, such as text that is not valid UTF-8 when converting it with iconv or with the multibyte functions.

ERESTART
Linux 85macOS —

Interrupted system call should be restarted

The interrupted call should be restarted. It is for internal kernel use and should not reach programs.

ESTRPIPE
Linux 86macOS —

Streams pipe error

STREAMS pipe error. ALSA returns it when the audio device is suspended.

EUSERS
Linux 87macOS 68

Too many users

Too many users. The disk quota system returns it when its table fills up, and it is uncommon.

ENOTSOCK
Linux 88macOS 38

Socket operation on non-socket

A socket operation was used on a descriptor that is not a socket.

EDESTADDRREQ
Linux 89macOS 39

Destination address required

Destination address required: data was sent through a connectionless socket without specifying where to.

EMSGSIZE
Linux 90macOS 40

Message too long

The message is too large for the socket, such as a UDP datagram larger than the maximum or than the MTU when fragmentation is not allowed.

EPROTOTYPE
Linux 91macOS 41

Protocol wrong type for socket

The protocol does not match the socket type.

ENOPROTOOPT
Linux 92macOS 42

Protocol not available

The requested socket option or protocol is not available, for example a setsockopt option that the kernel does not know.

EPROTONOSUPPORT
Linux 93macOS 43

Protocol not supported

The protocol is not supported, for example because its kernel module is not loaded.

ESOCKTNOSUPPORT
Linux 94macOS 44

Socket type not supported

The socket type is not supported in that address family.

EOPNOTSUPP
Linux 95macOS 102

Operation not supported

macOS: Operation not supported on socket

The operation is not supported by the socket or the object. On Linux it has the same value as ENOTSUP, and many file systems return it for features they do not implement, such as fallocate or extended attributes.

ENOTSUP
Linux 95macOS 45

Operation not supported

The operation is not supported. On Linux it has the same value as EOPNOTSUPP (95); on macOS they are different codes.

EPFNOSUPPORT
Linux 96macOS 46

Protocol family not supported

The protocol family is not supported.

EAFNOSUPPORT
Linux 97macOS 47

Address family not supported by protocol

macOS: Address family not supported by protocol family

The address family is not supported; it is typical when using IPv6 on a system or container that has it disabled.

EADDRINUSE
Linux 98macOS 48

Address already in use

The address and port are already in use: another process is listening on that port, or the previous connection is still in TIME_WAIT. Find the process with ss -ltnp or lsof -i :PORT, or use SO_REUSEADDR.

EADDRNOTAVAIL
Linux 99macOS 49

Cannot assign requested address

macOS: Can't assign requested address

The requested address cannot be assigned: the IP does not belong to any interface on the machine, or the ephemeral ports for outgoing connections have run out.

ENETDOWN
Linux 100macOS 50

Network is down

The network interface is down.

ENETUNREACH
Linux 101macOS 51

Network is unreachable

The destination network is unreachable because there is no route to it. Check the routing table and the gateway; it also happens when connecting over IPv6 without IPv6 connectivity.

ENETRESET
Linux 102macOS 52

Network dropped connection on reset

The network reset the connection, for example when a keepalive fails.

ECONNABORTED
Linux 103macOS 53

Software caused connection abort

The connection was aborted on the local side, for example because the client closed it before the server accepted it with accept.

ECONNRESET
Linux 104macOS 54

Connection reset by peer

The other end abruptly closed the connection with an RST (“Connection reset by peer”): the remote process shut down, a firewall or a load balancer cut the idle connection, or data was sent that the other side did not expect.

ENOBUFS
Linux 105macOS 55

No buffer space available

No kernel buffer space is available for the network operation; it usually appears under heavy traffic or when the socket queues are full.

EISCONN
Linux 106macOS 56

Transport endpoint is already connected

macOS: Socket is already connected

The socket is already connected.

ENOTCONN
Linux 107macOS 57

Transport endpoint is not connected

macOS: Socket is not connected

The socket is not connected: an attempt was made to send or receive before connecting, or the connection has already been closed. On a FUSE mount it appears as “Transport endpoint is not connected” when its process has died; it is fixed by unmounting with fusermount -u.

ESHUTDOWN
Linux 108macOS 58

Cannot send after transport endpoint shutdown

macOS: Can't send after socket shutdown

Cannot send after that direction of the socket has been closed with shutdown.

ETOOMANYREFS
Linux 109macOS 59

Too many references: cannot splice

macOS: Too many references: can't splice

Too many references; on Linux, when passing too many nested descriptors through a Unix socket.

ETIMEDOUT
Linux 110macOS 60

Connection timed out

macOS: Operation timed out

The connection timed out because the destination did not respond. It is usually caused by a firewall that silently drops the packets, a host that is down or a route that does not get there.

ECONNREFUSED
Linux 111macOS 61

Connection refused

The destination refused the connection: the machine responds, but nothing is listening on that port or a firewall replies with a rejection. Check that the service is running and listening on the right interface, not only on 127.0.0.1.

EHOSTDOWN
Linux 112macOS 64

Host is down

The destination host is down.

EHOSTUNREACH
Linux 113macOS 65

No route to host

No route to the host: it does not respond to ARP on the local network, or a router or firewall reports that it is unreachable.

EALREADY
Linux 114macOS 37

Operation already in progress

An operation is already in progress on the socket, such as a non-blocking connect that has not finished yet.

EINPROGRESS
Linux 115macOS 36

Operation now in progress

The operation is in progress: a non-blocking connect has started and will finish later. It is not an error; wait with poll or select.

ESTALE
Linux 116macOS 70

Stale file handle

macOS: Stale NFS file handle

The file handle is stale: on NFS, the file or directory was deleted or replaced on the server. It is fixed by opening the path again or remounting.

EUCLEAN
Linux 117macOS —

Structure needs cleaning

The structure needs cleaning: the file system detected corruption (on ext4 and XFS, under the alias EFSCORRUPTED). Unmount it and run fsck or xfs_repair.

Same value:EFSCORRUPTED

ENOTNAM
Linux 118macOS —

Not a XENIX named type file

Not a XENIX named type file. It is an unused legacy code.

ENAVAIL
Linux 119macOS —

No XENIX semaphores available

No XENIX semaphores available. It is an unused legacy code.

EISNAM
Linux 120macOS —

Is a named type file

Is a XENIX named type file. It is an unused legacy code.

EREMOTEIO
Linux 121macOS —

Remote I/O error

Remote I/O error, for example from an I2C device or a remote disk that did not respond.

EDQUOT
Linux 122macOS 69

Disk quota exceeded

macOS: Disc quota exceeded

The user's or group's disk quota was exceeded.

ENOMEDIUM
Linux 123macOS —

No medium found

There is no medium in the device, such as a drive with no disc or an empty card reader.

EMEDIUMTYPE
Linux 124macOS —

Wrong medium type

The medium type is wrong.

ECANCELED
Linux 125macOS 89

Operation canceled

The operation was canceled, for example an asynchronous I/O or an io_uring wait.

ENOKEY
Linux 126macOS —

Required key not available

The required key is not in the kernel keyring. It appears with encrypted file systems, such as fscrypt or eCryptfs, when the key has not been loaded.

EKEYEXPIRED
Linux 127macOS —

Key has expired

The key has expired. PAM and Kerberos also use it when the password or the ticket has expired.

EKEYREVOKED
Linux 128macOS —

Key has been revoked

The key has been revoked.

EKEYREJECTED
Linux 129macOS —

Key was rejected by service

The service rejected the key.

EOWNERDEAD
Linux 130macOS 105

Owner died

macOS: Previous owner died

The owner of a robust mutex died without releasing it. The new owner must make the protected state consistent and call pthread_mutex_consistent.

ENOTRECOVERABLE
Linux 131macOS 104

State not recoverable

The state protected by a robust mutex cannot be recovered, because the previous owner died and nobody marked it as consistent.

ERFKILL
Linux 132macOS —

Operation not possible due to RF-kill

The operation is not possible because the Wi-Fi or Bluetooth radio is blocked by RF-kill. Check rfkill list, the hardware switch or the airplane mode key.

EHWPOISON
Linux 133macOS —

Memory page has hardware error

The memory page has a hardware error and the kernel marked it as poisoned.

EFTYPE
Linux 134macOS 79

Inappropriate file type or format

The file type is not appropriate for the operation. It has long existed on macOS and BSD; on Linux it was added recently.

EPROCLIM
Linux —macOS 67

Too many processes

Too many processes. BSD defines it for the process limit, although in practice fork returns EAGAIN.

EBADRPC
Linux —macOS 72

RPC struct is bad

The RPC structure is bad (Sun RPC, used by NFS).

ERPCMISMATCH
Linux —macOS 73

RPC version wrong

The RPC version does not match (Sun RPC, used by NFS).

EPROGUNAVAIL
Linux —macOS 74

RPC program not available

macOS: RPC prog. not avail

The RPC program is not available on the server.

EPROGMISMATCH
Linux —macOS 75

RPC program version wrong

macOS: Program version wrong

The RPC program version does not match.

EPROCUNAVAIL
Linux —macOS 76

RPC bad procedure for program

macOS: Bad procedure for program

The procedure does not exist in the RPC program.

EAUTH
Linux —macOS 80

Authentication error

Authentication error, for example when mounting an NFS share.

ENEEDAUTH
Linux —macOS 81

Need authenticator

An authenticator is needed for the operation.

EPWROFF
Linux —macOS 82

Device power is off

The device is powered off.

EDEVERR
Linux —macOS 83

Device error, e.g. paper out

Device error, for example a printer out of paper.

EBADEXEC
Linux —macOS 85

Bad executable

The executable is not valid.

EBADARCH
Linux —macOS 86

Bad CPU type in executable

The executable is for another CPU type, such as an x86_64-only binary on an Apple Silicon Mac without Rosetta 2, or an ARM one on an Intel Mac.

ESHLIBVERS
Linux —macOS 87

Shared library version mismatch

The shared library version does not match.

EBADMACHO
Linux —macOS 88

Malformed Macho file

The Mach-O file is malformed or corrupted.

ENOATTR
Linux —macOS 93

Attribute not found

The extended attribute does not exist; it is the equivalent of Linux's ENODATA. It appears with xattr, for example when removing com.apple.quarantine from a file that does not have it.

ENOPOLICY
Linux —macOS 103

No such policy registered

No policy is registered with that name in the MAC Framework.

EQFULL
Linux —macOS 106

Interface output queue is full

The output queue of the network interface is full.

ENOTCAPABLE
Linux —macOS 107

Capabilities insufficient

Insufficient capabilities: returned by calls that a sandbox restricts.

SIGSignals33
SIGHUP
Linux 1macOS 1

Hangup

The terminal that controlled the process was closed or the SSH session dropped. Many daemons, such as nginx, sshd or rsyslog, use it as a request to reload their configuration; nohup, tmux and screen prevent it from closing processes on exit.

Terminates the process
SIGINT
Linux 2macOS 2

Interrupt

Keyboard interrupt with Ctrl+C. The program can catch it to shut down cleanly. Exit code 130.

Terminates the process
SIGQUIT
Linux 3macOS 3

Quit

Keyboard quit with Ctrl+\. It terminates the process with a core dump; the JVM, instead, uses it to print the state of its threads.

Terminates with a core dump
SIGILL
Linux 4macOS 4

Illegal instruction

The processor encountered an illegal instruction: a binary built for a newer CPU (for example, with AVX2 or AVX-512 on a processor that lacks them), corrupted code or a jump into data.

Terminates with a core dump
SIGTRAP
Linux 5macOS 5

Trace/breakpoint trap

Debug trap: debuggers use it for breakpoints. If it arrives without a debugger, it is usually a failure detected by the program itself, such as Swift's checks on macOS.

Terminates with a core dump
SIGABRT
Linux 6macOS 6

Aborted

The process called abort(): a failed assertion, an uncaught C++ exception or heap corruption detected by the C library (“double free or corruption”). Exit code 134.

Terminates with a core dump

Same value:SIGIOT

SIGBUS
Linux 7macOS 10

Bus error

Bus error: a misaligned memory access on some architectures, or an access to part of an mmap-mapped file that no longer exists because the file was truncated. It also happens when /dev/shm fills up.

Terminates with a core dump
SIGFPE
Linux 8macOS 8

Floating point exception

Arithmetic exception. Despite the name, the most common cause is an integer division by zero.

Terminates with a core dump
SIGKILL
Linux 9macOS 9

Killed

Terminates the process immediately: it cannot be caught, blocked or ignored. It is sent by kill -9, by the kernel's OOM killer when memory runs out, and by Docker or Kubernetes when a container exceeds its memory limit (OOMKilled) or does not exit in time after SIGTERM. Exit code 137.

Terminates the processCannot be caught
SIGUSR1
Linux 10macOS 30

User defined signal 1

Free signal for each application to use as it sees fit; for example, dd reports its progress and nginx reopens its logs.

Terminates the process
SIGSEGV
Linux 11macOS 11

Segmentation fault

Segmentation violation (“Segmentation fault”): an invalid memory access, such as dereferencing a null pointer, going past the end of an array or overflowing the stack with infinite recursion. Exit code 139.

Terminates with a core dump
SIGUSR2
Linux 12macOS 31

User defined signal 2

Second free signal for each application to use as it sees fit.

Terminates the process
SIGPIPE
Linux 13macOS 13

Broken pipe

Write to a pipe or socket with no reader. It is normal in cmd | head, where the reader exits first; servers usually ignore it and handle the EPIPE error. Exit code 141.

Terminates the process
SIGALRM
Linux 14macOS 14

Alarm clock

The timer set with alarm or setitimer expired.

Terminates the process
SIGTERM
Linux 15macOS 15

Terminated

Request for graceful termination. It is the default signal of kill, systemctl stop, docker stop and of Kubernetes when deleting a pod; the process should close its connections and exit. Exit code 143.

Terminates the process
SIGSTKFLT
Linux 16macOS —

Stack fault

Coprocessor stack fault. Not used on current Linux.

Terminates the process
SIGCHLD
Linux 17macOS 20

Child exited

A child process exited, stopped or continued. The parent must reap it with wait; if it does not, the child becomes a zombie.

Ignored

Same value:SIGCLD

SIGCONT
Linux 18macOS 19

Continued

Resumes a stopped process, as fg and bg do in the shell.

Resumes the process
SIGSTOP
Linux 19macOS 17

Stopped (signal)

Stops the process; it cannot be caught or ignored. It is resumed with SIGCONT.

Stops the processCannot be caught
SIGTSTP
Linux 20macOS 18

Stopped

Stop from the terminal with Ctrl+Z. Unlike SIGSTOP, the program can catch it.

Stops the process
SIGTTIN
Linux 21macOS 21

Stopped (tty input)

A background process tried to read from the terminal.

Stops the process
SIGTTOU
Linux 22macOS 22

Stopped (tty output)

A background process tried to write to the terminal with stty tostop enabled, or to change its settings.

Stops the process
SIGURG
Linux 23macOS 16

Urgent I/O condition

Urgent (out-of-band) data arrived on a socket. Go uses it internally to interrupt goroutines.

Ignored
SIGXCPU
Linux 24macOS 24

CPU time limit exceeded

The process exceeded its CPU time limit (ulimit -t).

Terminates with a core dump
SIGXFSZ
Linux 25macOS 25

File size limit exceeded

The process exceeded the maximum file size it is allowed (ulimit -f).

Terminates with a core dump
SIGVTALRM
Linux 26macOS 26

Virtual timer expired

The virtual timer expired, which counts only the CPU time of the process.

Terminates the process
SIGPROF
Linux 27macOS 27

Profiling timer expired

The profiling timer, used by profilers, expired.

Terminates the process
SIGWINCH
Linux 28macOS 28

Window changed

The terminal window size changed; full-screen programs use it to redraw themselves.

Ignored
SIGIO
Linux 29macOS 23

input/output possible signal

I/O is available on a descriptor configured with O_ASYNC. On Linux, SIGPOLL is the same signal.

Terminates the process

Same value:SIGPOLL

SIGPWR
Linux 30macOS —

Power failure

Power failure, which UPS software reports to the init system.

Terminates the process
SIGSYS
Linux 31macOS 12

Bad system call

Bad system call. Nowadays the usual cause is a seccomp filter that blocks it, as in containers.

Terminates with a core dump
SIGEMT
Linux —macOS 7

EMT trap

Emulation trap (EMT). It exists on macOS and BSD, but not on Linux on x86 or ARM.

Terminates with a core dump
SIGINFO
Linux —macOS 29

Information request

Information request with Ctrl+T in the macOS and BSD terminal; many commands respond by showing their progress.

Ignored
$?Exit codes24
0EXIT_SUCCESS

The command finished successfully. It is the only code that means success: any other value indicates an error.

C
1EXIT_FAILURE

General error; each program decides what it means. The details are usually in what the command wrote to stderr. grep and diff use it with a different meaning: “no matches found” or “the files differ”.

C
2Misuse of shell builtins

Misuse of a shell builtin or a syntax error in the script. Many programs also use it for invalid options, and grep for actual errors.

Bash
64EX_USAGE

The command was used incorrectly: arguments are missing, there are too many or an option is wrong.

sysexits.h
65EX_DATAERR

The input data has an incorrect format.

sysexits.h
66EX_NOINPUT

An input file does not exist or cannot be read.

sysexits.h
67EX_NOUSER

The specified user does not exist; it is used mainly by mail programs.

sysexits.h
68EX_NOHOST

The host name does not exist.

sysexits.h
69EX_UNAVAILABLE

A required service is not available, or something failed that does not fit into another category.

sysexits.h
70EX_SOFTWARE

Internal program error.

sysexits.h
71EX_OSERR

Operating system error, such as being unable to fork or to create a pipe.

sysexits.h
72EX_OSFILE

A system file, such as /etc/passwd, is missing or has an error.

sysexits.h
73EX_CANTCREAT

An output file cannot be created.

sysexits.h
74EX_IOERR

Input/output error while reading or writing a file.

sysexits.h
75EX_TEMPFAIL

Temporary failure: it is worth retrying later. Mail servers use it to leave the message in the queue.

sysexits.h
76EX_PROTOCOL

The remote system responded with something that does not follow the protocol.

sysexits.h
77EX_NOPERM

Insufficient permissions for the operation.

sysexits.h
78EX_CONFIG

There is an error in the configuration.

sysexits.h
124Timed out

The timeout command terminated it because it exceeded the specified time.

GNU timeout
125Container failed to run

docker run itself failed before running the container, for example because of an incorrect option or a daemon error. GNU timeout also returns it when it is the one that fails.

Docker
126Command invoked cannot execute

The file exists, but it cannot be executed: it lacks execute permission, it is a directory or it is a binary for another architecture. In Docker, the container command is not executable.

POSIX
127Command not found

Command not found: it is not installed, it is not in the PATH or its name is misspelled. In scripts it also appears when the interpreter in the #! line is missing; in Docker, when the container command does not exist in the image.

POSIX
128Fatal error

Codes above 128 indicate that a signal terminated the process, but 128 does not correspond to any. Git uses it for all its fatal errors (“fatal: …”), such as a repository that does not exist or an authentication failure when cloning.

Git
255Exit status out of range

The exit code was out of range: exit -1 arrives as 255, because only 8 bits are kept. ssh also returns it when the connection or authentication fails, to distinguish it from the remote command's code.

POSIX

The Linux values are those of x86, x86-64 and ARM; Alpha, MIPS, SPARC and PA-RISC number some errno values and signals differently. The English messages are the ones shown by strerror and strsignal in glibc, and by macOS when they differ. Exit codes above 128 are interpreted as 128 plus the signal number, which is the convention of bash, Docker and Kubernetes.

How it works

When a system call fails on Linux, it returns -1 and leaves a number in the errno variable that says why: 2 is ENOENT, the file does not exist; 13 is EACCES, permission denied. strerror turns that number into the text shown on screen, such as “No such file or directory”. Python shows it as [Errno 13], Node.js as code: 'ECONNREFUSED' and Go, Rust or Java with the same text. Numbers 1 to 34 come from the original Unix and are the same on every system; the following ones were numbered by each system in its own way, so ECONNREFUSED is 111 on Linux and 61 on macOS. The name is portable; the number is not.

Signals are notifications that the kernel or another process sends to a process: SIGINT when Ctrl+C is pressed, SIGTERM to ask it to terminate, SIGKILL to terminate it without asking, SIGSEGV when it accesses invalid memory. Each one has a default action, and almost all of them can be caught to do something else. When a signal kills a process, the shell reports an exit code of 128 plus the signal number: 137 is SIGKILL (9), 139 is SIGSEGV (11) and 143 is SIGTERM (15). Docker and Kubernetes use the same convention.

The exit code is the number a program leaves when it finishes: 0 means success and any other value, an error. Only 8 bits are kept, so it ranges from 0 to 255. There are few conventions: 126 and 127 are used by the shell when it cannot execute or cannot find the command, 64 to 78 are defined by BSD's sysexits.h, and the rest is up to each program, like grep, which returns 1 when it finds nothing.

Examples

Last State: Terminated · Reason: OOMKilled · Exit Code: 137137 = 128 + 9 · SIGKILLThe container exceeded its memory limit and the kernel killed it with SIGKILL. Raise the limit in resources.limits.memory or find out why the process uses so much; restarting it does not fix it.
Error: connect ECONNREFUSED 127.0.0.1:5432ECONNREFUSED · Linux 111 · macOS 61 · Connection refusedNode.js could not connect to PostgreSQL because nothing is listening on port 5432. If the application runs in a container, 127.0.0.1 is the container itself and not the host machine: use the name of the database service.
OSError: [Errno 48] Address already in useEADDRINUSE · Linux 98 · macOS 48The 48 gives away that the program runs on macOS: on Linux the same error is 98. In both cases another process is already using the port; lsof -i :PORT shows which one.

Use cases

  • Understand an error from an application in Python, Node.js, Go or C that only shows the errno number or name.
  • Find out from its exit code why a Docker container stopped or a Kubernetes pod keeps restarting.
  • Map a macOS errno number to the right name, which from 35 onwards does not match the Linux one.
  • Interpret the exit code of a failed script, cron job or CI job.
  • Choose which signal to send with kill and know what the process does if it does not catch it.
  • Write portable error handling that compares by name instead of by number.

Frequently asked questions

What does exit code 137 mean?

That the process was terminated by signal 9, SIGKILL (128 + 9). The most common cause is memory: the container exceeded its limit, which Kubernetes reports as OOMKilled, or the kernel's OOM killer chose that process, which shows up in dmesg as “Out of memory: Killed process”. It also happens with docker kill, or when the process does not exit within the grace period after SIGTERM: 10 seconds in docker stop and 30 in Kubernetes.

What is the difference between SIGTERM and SIGKILL?

SIGTERM asks the process to terminate, and the process can catch it to close connections, save data and exit. With SIGKILL, the kernel terminates it on the spot, and the process can do nothing about it. The right thing is to send SIGTERM, wait a few seconds and resort to SIGKILL only if it is still alive, which is what systemd, docker stop and Kubernetes do.

Why does the same errno have a different number on macOS?

Because POSIX defines the names but not the numbers. From 1 to 34, every system inherited those of the original Unix; after that, BSD, which macOS comes from, and System V, which Linux followed, numbered them separately. That is why you should always compare by name, with errno.ECONNREFUSED in Python, err.code in Node.js or the constant in C, and not by number.

What is the difference between EACCES and EPERM?

EACCES (“Permission denied”) means that the permissions of the file or of some directory in the path do not allow it, or that an ACL or SELinux prevents it: it is solved with chmod, chown or the corresponding policy. EPERM (“Operation not permitted”) means that the operation itself requires privileges, regardless of permissions, such as changing the owner of a file or killing another user's process: it takes root, a capability or removing an attribute such as the immutable one.

How do I see the exit code of a command or a container?

In bash and zsh, echo $? shows the one from the last command; in PowerShell, $LASTEXITCODE. In Docker, docker ps -a shows it in the STATUS column, as “Exited (137)”. In Kubernetes, kubectl describe pod shows it under “Last State: Terminated”, along with the reason, such as OOMKilled or Error.