128
BashERRORCommonExit CodeHIGH confidence
Invalid argument to exit
What this means
Exit code 128 is returned when the `exit` command is used with an invalid argument. The argument must be an integer between 0 and 255.
Why it happens
- 1Calling `exit` with a non-numeric string.
- 2Calling `exit` with a floating-point number.
- 3Calling `exit` with a value greater than 255 (the shell will use the value modulo 256).
How to reproduce
A script attempts to exit with a status code that is not a valid integer.
trigger — this will error
trigger — this will error
#!/bin/bash exit "not-a-number" echo "This will not be printed"
expected output
bash: exit: not-a-number: numeric argument required Exit: 128
Fix
Ensure exit argument is an integer
WHEN Using the `exit` command
Ensure exit argument is an integer
status=10 # some logic exit $status
Why this works
Only pass integers to the `exit` command.
What not to do
✕ Use string messages as exit codes
Exit statuses must be integers for the shell to process them correctly.
Sources
Official documentation ↗
GNU Bash Manual
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev