Theory of Reply Codes
Revised FTP Reply Codes
RFC 640, Jonathan B. Postal, June 1974

A standard Internet error code consists of four parts: 3 reply digits and a reply text. The FTP conventions are widely adopted in other transfer protocols, including SMTP and HTTP.

The three digits of the reply each have a special significance. The first digit denotes whether the response is good, bad or incomplete. An unsophisticated client can determine its next action by simply examining this first digit.

Reply codes must strictly follow the specifications in this section. Receiver implementations should not invent new codes for slightly different situations from the ones described here, but rather adapt codes already defined.

1st digit: Reply Status

Code Status and description
1yz Positive Preliminary reply
The command has been accepted, but the requested action is being held in abeyance, pending confirmation of the information in this reply. The sender-SMTP should send another command specifying whether to continue or abort the action.
2yx Positive Completion reply
The requested action has been successfully completed. A new request may be initiated.
3yx Positive Intermediate reply
The command has been accepted, but the requested action is being held in abeyance, pending receipt of further information. The sender-SMTP should send another command specifying this information. This reply is used in command sequence groups.
4yz Transient Negative Completion reply
The command was not accepted and the requested action did not occur. However, the error condition is temporary and the action may be requested again. The sender should return to the beginning of the command sequence (if any).
5yz Permanent Negative Completion reply
The command was not accepted and the requested action did not occur. The sending process is discouraged from repeating the exact request (in the same sequence). Even some "permanent" error conditions can be corrected, so the human user may want to reinitiate the command sequence by direct action at some point in the future (e.g., after the spelling has been changed, or the user has altered the account status).

2nd digit: Reply Categories

Code Category and description
x0z Syntax
These replies refer to syntax errors, syntactically correct commands that don't fit any functional category, and unimplemented or superfluous commands.
x1z Information
These are replies to requests for information, such as status or help.
x2z Connections
These are replies referring to the transmission channel.
x3z Unspecified as yet.
4yz Unspecified as yet.
x5z Protocol defined
These replies indicate the status of the protocol receiver vis-a-vis the requested transfer or other action.

3rd digit: Reply Details

The third digit gives a finer gradation of meaning in each category specified by the second digit. The list of replies illustrates this. Each reply text is recommended rather than mandatory, and may even change according to the command with which it is associated.

Reply Text: User Information

If the reply text is longer than a single line, every line except the last will begin with the reply code, followed immediately by a hyphen (minus), followed by text. The last line will begin with the reply code, followed immediately by <SP>, optionally some text, and <CRLF>.

For example:

123-First line
123-Second line
123-234 text beginning with numbers
123 The last line