exit code

An exit code is the integer a program or script returns to its caller on termination to indicate whether it succeeded or failed.

3 articlesLast mentioned

An exit code is an integer that a process returns to its parent process or shell when it finishes running. It is also called an exit status or return code. On Unix-like operating systems, the convention is that 0 means success and any nonzero value means failure or an error, with values ranging from 0 to 255. The meaning of each nonzero value is defined by the individual program.

Shells expose the exit code of the most recent command through a special variable, and conditionals and command-chaining operators use it to decide what runs next. Shell scripts, build tools, test runners, and CI pipelines rely on exit codes to judge whether a step passed or failed. AI coding agents likewise read the exit codes of the commands and automated scripts they run to decide whether to continue or to fix a problem.

This entry is based on AIPOST articles and widely known facts. If something is wrong, please send us a correction request.

Articles covering this entry

  • Claude Code Best Practices: Five Jobs to Stop Doing by HandAI in Practice ·

    Get the exit code right.

    Read article
  • Claude Code Multi-Agent Pipeline: Role Splits and Rules for When to StopAI in Practice ·

    When the same "I'm in a hurry" bypass prompt was repeated, the hook returned exit code 2, the merge halted, and main stayed unchanged.

    Read article
  • Why Claude Code Gets More From the Same Model: Five Parts of a HarnessAI in Practice ·

    The signal is often as simple as an exit code: 0 means success and anything else means an error.

    Read article

Found a mistake or missing an entry?

Wiki entries are based on AIPOST articles and widely known facts. If an entry is wrong, send us a correction request and we will check and fix it. Names from new articles are added to the wiki after the article is published.