Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Exit Codes

stacy uses consistent exit codes to indicate success or failure type.

Exit Code Table

CodeNameDescription
0SuccessOperation completed successfully
1Stata ErrorStata r() code detected in log
2Syntax ErrorInvalid Stata syntax
3File ErrorFile not found, permission denied, data errors
4Memory ErrorInsufficient memory
5Internal Errorstacy itself failed (not Stata)
10Environment ErrorStata not found or configuration invalid

Stata r() Code Mapping

stacy maps Stata’s r() error codes to exit codes:

Exit CodeStata r() Codes
1most r() codes not in other categories
2r(198), r(199)
3r(601), r(603), r(610), r(639), r(2000-2999)
4r(950)

Usage

Shell

stacy run analysis.do
echo $?  # 0 on success, 1-10 on failure

Makefile

results.dta: analysis.do
	stacy run analysis.do  # Stops on non-zero exit

Stability

Exit codes 0-10 are stable and will not change meaning. New categories may be added with codes 11+.

See Also