In
computing
Computing is any goal-oriented activity requiring, benefiting from, or creating computer, computing machinery. It includes the study and experimentation of algorithmic processes, and the development of both computer hardware, hardware and softw ...
, an error code (or a return code) is a numeric or
alphanumeric
Alphanumericals or alphanumeric characters are any collection of number characters and letters in a certain language. Sometimes such characters may be mistaken one for the other.
Merriam-Webster suggests that the term "alphanumeric" may often ...
code that indicates the nature of an error and, when possible, why it occurred. Error codes can be reported to end users of software, returned from
communication protocols, or used within programs as a method of representing anomalous conditions.
In consumer products

Error codes are commonly encountered on displays of consumer electronics to users in order to communicate or specify an error. They can also be indicated by lights or beeps, e.g., if a device does not have a display. They are commonly reported by consumer electronics when users bring electronics to perform tasks that they cannot do (e.g.,
dividing by zero), or when the program within a device encounters an anomalous condition.
Error codes reported by consumer electronics are used to help diagnose and repair technical problems. An error code can be communicated to relevant support staff to identify potential fixes, or can simplify research into the cause of an error.
There is no definitive format for error codes, meaning that error codes typically differ from/between products and or companies.
In computer programming
Error codes in computers can be passed to the system itself, to judge how to respond to the error. Often error codes come synonymous with an
exit code or a return value. The system may also choose to pass the error code to its user(s). The
Blue screen of death
The blue screen of death (BSoD) or blue screen error, blue screen, fatal error, bugcheck, and officially known as a stop erroris a fatal system error, critical error screen displayed by the Microsoft Windows operating systems to indicate a cr ...
is an example of how the
Windows operating system communicates error codes to the user.
Error codes can be used within a computer program to represent an anomalous condition. A computer program can take different actions depending on the value of an error code.
Different programming languages, operating systems, and programming environments often have their own conventions and standards for the meanings and values of error codes. Examples include:
*
Unix-like
A Unix-like (sometimes referred to as UN*X, *nix or *NIX) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Uni ...
systems have an
errno.h header file that contains the meanings and values of error codes returned by
system call
In computing, a system call (syscall) is the programmatic way in which a computer program requests a service from the operating system on which it is executed. This may include hardware-related services (for example, accessing a hard disk drive ...
s and library functions.
*
Microsoft Windows' application programming interfaces (APIs) have several different standards for error code values, depending on the specific API being used.
The usage of error codes as an error handling strategy is often contrasted against using
exceptions for error handling.
In communication protocols
Communication protocol
A communication protocol is a system of rules that allows two or more entities of a communications system to transmit information via any variation of a physical quantity. The protocol defines the rules, syntax, semantics (computer science), sem ...
s typically define a standard set of error codes, as a means of communicating the status or result of an operation between the entities in the system.
Several high-level protocols in the
TCP/IP stack, such as
HTTP
HTTP (Hypertext Transfer Protocol) is an application layer protocol in the Internet protocol suite model for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide Web, wher ...
,
FTP
The File Transfer Protocol (FTP) is a standard communication protocol used for the transfer of computer files from a server to a client on a computer network. FTP is built on a client–server model architecture using separate control and dat ...
, and
SMTP
The Simple Mail Transfer Protocol (SMTP) is an Internet standard communication protocol for electronic mail transmission. Mail servers and other message transfer agents use SMTP to send and receive mail messages. User-level email clients typi ...
, define their own standard sets of error codes:
*
List of HTTP status codes
Hypertext Transfer Protocol (HTTP) response status codes are issued by a server in response to a client's request made to the server. It includes codes from IETF Request for Comments (RFCs), other specifications, and some additional codes us ...
*
List of FTP server return codes
File Transfer Protocol, FTP Server (computing), server return codes always have three digits, and each digit has a special meaning. The first digit denotes whether the response is good, bad or incomplete:
The second digit is a grouping digit and ...
*
In automobiles
Error codes in automobiles, sometimes referred to as trouble codes, indicate to a driver or car mechanic what is wrong with a vehicle before repairs are initiated.
In
vehicle
A vehicle () is a machine designed for self-propulsion, usually to transport people, cargo, or both. The term "vehicle" typically refers to land vehicles such as human-powered land vehicle, human-powered vehicles (e.g. bicycles, tricycles, velo ...
s with
CAN bus
A controller area network bus (CAN bus) is a vehicle bus standard designed to enable efficient communication primarily between electronic control units (ECUs). Originally developed to reduce the complexity and cost of electrical wiring in auto ...
es, error codes are often five-digit codes that pinpoint a particular car fault. Car owners can make use of an
on-board diagnostics scanner or an owner's manual to identify the meaning of a trouble code. Five-digit diagnostic trouble codes typically consist of one letter and four numbers (e.g. P0123).
See also
*
Abort (computing)
In a computer or data transmission system, to abort means to Wiktionary:terminate, terminate, usually in a controlled manner, a processing activity because it is impossible or undesirable for the activity to proceed or in conjunction with an err ...
*
Aspect-oriented programming
*
Blue Screen of Death
The blue screen of death (BSoD) or blue screen error, blue screen, fatal error, bugcheck, and officially known as a stop erroris a fatal system error, critical error screen displayed by the Microsoft Windows operating systems to indicate a cr ...
*
errno.h, a header file in C that defines macros for reporting errors
*
Exit status
In computing, the exit status (also exit code or exit value) of a terminated process is an integer number that is made available to its parent process (or caller). In DOS, this may be referred to as an errorlevel.
When computer programs ar ...
*
Failure
Failure is the social concept of not meeting a desirable or intended objective, and is usually viewed as the opposite of success. The criteria for failure depends on context, and may be relative to a particular observer or belief system. On ...
*
HRESULT, a computer programming
data type
In computer science and computer programming, a data type (or simply type) is a collection or grouping of data values, usually specified by a set of possible values, a set of allowed operations on these values, and/or a representation of these ...
used for error codes
*
Static code analysis
In computer science, static program analysis (also known as static analysis or static simulation) is the analysis of computer programs performed without executing them, in contrast with dynamic program analysis, which is performed on programs duri ...
References
{{Reflist
External links
Microsoft system error codesMicrosoft Device Manager error codes
Software