# Command Line Observability with Semantic Exit Codes

DevFeed: [Command Line Observability with Semantic Exit Codes](<https://devfeed.tech/articles/command-line-observability-with-semantic-exit-codes-15583.md>)

Original publisher: [Read original article](<https://developer.squareup.com/blog/command-line-observability-with-semantic-exit-codes>)

Author: Bob Lail

Published: 2023-01-03T05:00:00Z

Content type: article

Language: en

Sources: [Square Corner](<https://devfeed.tech/sources/square-corner-blog-medium.md>)

Topics: [Command-line interface](<https://devfeed.tech/topics/cli.md>), [observability](<https://devfeed.tech/topics/observability.md>), [Developer Tools](<https://devfeed.tech/topics/developer-tools.md>), [Platform Engineering](<https://devfeed.tech/topics/platform-engineering.md>), [Tool](<https://devfeed.tech/topics/tool.md>), [Bash](<https://devfeed.tech/topics/bash.md>)

Tags: [2](<https://devfeed.tech/tags/2.md>), [adopting](<https://devfeed.tech/tags/adopting.md>), [allowed](<https://devfeed.tech/tags/allowed.md>), [also](<https://devfeed.tech/tags/also.md>), [apply](<https://devfeed.tech/tags/apply.md>), [argument](<https://devfeed.tech/tags/argument.md>), [automate](<https://devfeed.tech/tags/automate.md>), [bash](<https://devfeed.tech/tags/bash.md>), [bootstrap](<https://devfeed.tech/tags/bootstrap.md>), [command](<https://devfeed.tech/tags/command.md>), [command-line](<https://devfeed.tech/tags/command-line.md>), [drawing](<https://devfeed.tech/tags/drawing.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [exit](<https://devfeed.tech/tags/exit.md>), [http](<https://devfeed.tech/tags/http.md>), [inspiration](<https://devfeed.tech/tags/inspiration.md>), [observability](<https://devfeed.tech/tags/observability.md>), [semantic](<https://devfeed.tech/tags/semantic.md>), [status](<https://devfeed.tech/tags/status.md>), [tools](<https://devfeed.tech/tags/tools.md>), [with](<https://devfeed.tech/tags/with.md>)

## AI overview

Square's Developer Tools team introduced semantic CLI exit codes to distinguish user errors from software failures and measure reliability. Because conventional exit codes treat every nonzero result as failure, they reserved codes 80-99 for user errors and 100-119 for software errors, with each range's first code serving as a catch-all. This separation supports SLOs on software failures and helps identify patterns such as common typos; tracking "Moved Permanently" errors can also show when migration breadcrumbs are no longer needed. The article notes that some sysexits.h codes are useful but others are sendmail-specific, and that its codes interleave user and software errors. Square open-sourced the codes and Go helper functions as github.com/square/exit, with other language implementations and range extensions planned.

## Source excerpt

Drawing inspiration from HTTP Status Codes to improve our Command Line tools