staticdata.dev
Menu
Datasets About Contact

Exit Codes

A curated reference of standard Unix and Linux process exit codes drawn from three authoritative sources — POSIX (exit status 0 for success), Bash shell conventions (codes 1, 2, 126–143), and the BSD sysexits.h header (codes 64–78). Each entry includes the numeric code, a canonical name, a plain-English description of when it occurs, and the originating standard so developers can distinguish shell-specific behavior from portable POSIX semantics.

Quick fetch

Stable URL. CORS-enabled. No auth.

bash
curl https://staticdata.dev/v1/exit-codes.json

Or use as a typed import: import { exitCodes } from "https://staticdata.dev/v1/exit-codes.ts"

Formats

  • JSON 6.7 KB

    /v1/exit-codes.json

    Open

    min: 5.7 KB · /v1/exit-codes.min.json

  • CSV 4.2 KB

    /v1/exit-codes.csv

    Open
  • TypeScript 6.9 KB

    /v1/exit-codes.ts

    export const exitCodes

    type ExitCode = (typeof exitCodes)[number]

    Open

Schema

Each record in the dataset has the following shape.

Schema
Field Type Description Example
code number Numeric exit code (0–255) 0
name string Short canonical name for the exit code EX_USAGE
description string Plain-English explanation of when this code is used The command was used incorrectly.
source string Originating standard: posix, bash, or sysexits sysexits

Preview

First 10 records.

Data preview
codenamedescriptionsource
0SuccessThe program completed successfully without errors.posix
1General ErrorCatchall for general errors; miscellaneous errors such as 'divide by zero' or other impermissible operations.bash
2Misuse of Shell BuiltinsMisuse of shell builtins (according to Bash documentation); missing keyword or command, or permission problem.bash
64EX_USAGEThe command was used incorrectly, e.g., with the wrong number of arguments, a bad flag, bad syntax in a parameter, etc.sysexits
65EX_DATAERRThe input data was incorrect in some way. This should only be used for user data and not system files.sysexits
66EX_NOINPUTAn input file (not a system file) did not exist or was not readable.sysexits
67EX_NOUSERThe user specified did not exist. This might be used for mail addresses or remote logins.sysexits
68EX_NOHOSTThe host specified did not exist. This is used in mail addresses or network requests.sysexits
69EX_UNAVAILABLEA service is unavailable. This can occur if a support program or file does not exist.sysexits
70EX_SOFTWAREAn internal software error has been detected. This should be limited to non-operating system related errors.sysexits

Showing 10 of 36. View full data:  JSON · CSV

Fetch examples

Drop-in snippets in five languages.

curl
curl -sSL https://staticdata.dev/v1/exit-codes.json | jq '.[0]'
JavaScript
import type { ExitCode } from "https://staticdata.dev/v1/exit-codes.ts";

const res = await fetch("https://staticdata.dev/v1/exit-codes.min.json");
if (!res.ok) throw new Error(`Fetch failed: ${res.status}`);
const exitCodes: ExitCode[] = await res.json();
console.log(exitCodes[0]);
Python
import urllib.request, json

with urllib.request.urlopen("https://staticdata.dev/v1/exit-codes.min.json") as r:
    exitCodes = json.load(r)

print(exitCodes[0])
Go
package main

import (
	"encoding/json"
	"fmt"
	"net/http"
)

func main() {
	resp, err := http.Get("https://staticdata.dev/v1/exit-codes.min.json")
	if err != nil { panic(err) }
	defer resp.Body.Close()

	var data []map[string]any
	if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
		panic(err)
	}
	fmt.Println(data[0])
}
Rust
use serde_json::Value;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let body = ureq::get("https://staticdata.dev/v1/exit-codes.min.json").call()?.into_string()?;
    let data: Vec<Value> = serde_json::from_str(&body)?;
    println!("{:?}", data.first());
    Ok(())
}

Sources and methodology

Exit codes (also called return codes or error codes) are the integer values a Unix process reports to its parent when it terminates. The value is available via $? in the shell or via waitpid(2) in C. Only the low 8 bits are meaningful, giving a usable range of 0–255. Code 0 universally means success per POSIX; any non-zero value signals some form of failure.

The BSD sysexits.h header, which originated with sendmail and appeared in BSD after 4.3BSD, defines codes 64–78 (EX_USAGE through EX_CONFIG) as a portable vocabulary for system programs. Sendmail, other mail transfer agents, and a number of BSD utilities use these values so callers can distinguish a configuration error from a temporary network failure without parsing stderr. POSIX shells layer additional reserved values on top: 126 (found but not executable), 127 (command not found), and 128+N for a process killed by signal N. Exit codes 129–143 therefore correspond to SIGHUP through SIGTERM; code 130 (128 + SIGINT) is by far the most commonly seen, produced whenever a user presses Ctrl+C.

Codes 3–63 and 79–125 are conventionally available for application-defined use, though several tools have established de-facto meanings (e.g., diff exits 1 for differences found, 2 for trouble; grep exits 1 for no match). Codes above 128 should be treated as signal-death indicators unless the application explicitly documents otherwise. Code 128 is listed by the Advanced Bash-Scripting Guide as “invalid argument to exit”, but current Bash actually exits with 2 in that case. Portability note: the 128+N values use Linux signal numbers. Several differ on macOS and the BSDs (there, 7 is SIGEMT, 10 is SIGBUS, 12 is SIGSYS and SIGUSR1/SIGUSR2 are 30/31), so codes 135, 138 and 140 are Linux-specific. Codes above 143 are platform-dependent and are not included in this dataset.

Versioning

URLs under /v1/ are stable: field names and types will not change in a way that breaks consumers. Values can be corrected or records added when the upstream source changes; schema-incompatible updates ship under a new version path. See the exit-codes changelog for this dataset's history.

Related datasets

More Code datasets