Skip to main content

USAGE_EXIT_CODE

Constant USAGE_EXIT_CODE 

Source
pub const USAGE_EXIT_CODE: i32 = 2;
Expand description

Process exit code returned when the argv is a valid parse but an invalid combination (EX_USAGE in spirit, 2 by this project’s contract).

GAP-SG-201 / GAP-SG-202 / GAP-SG-203 / GAP-SG-204: the agent-native surface can only discover some usage errors once it sees the envelope — a --filter key that exists nowhere in the result elements, or a predicate evaluated over a page the query already truncated. Refusing those needs an error that maps to the code clap already returns for a bad command line, so an agent branches on one number for “you asked for something impossible” regardless of whether the parser or the surface caught it.

2 rather than EX_USAGE (64): DUPLICATE_EXIT_CODE above was moved off 2 in v1.0.52 precisely to free it, src/main.rs already returns it for a rejected flag, and introducing 64 now would give this binary two codes for one meaning — which the exit-code rules forbid.