Linux system errors
Command Not Executable
Reviewed for reference consistency: August 11, 2026
the file was found but is not executable
What 126 Means
The 126 error on the Linux system errors indicates command not executable — the file was found but is not executable. This typically occurs due to the file lacks the execute permission bit, so the kernel refuses execution with eacces.
Exit code 126 occurs when the shell found the command you typed but could not execute it: the file exists, but the system refuses to run it as a program. Bash documents the split directly, a command that cannot be found returns 127, while a command that is found but not executable returns 126. The refusal usually traces back to a missing execute bit, a script whose interpreter path is wrong, a target that is not a regular file such as a directory, or a filesystem mounted noexec, all conditions the kernel reports as EACCES when execution is refused.
How to fix 126
General informational guidance, not professional advice. Commands can affect your system or data — back up first and proceed at your own risk. FixerCode is an independent reference, not affiliated with any vendor mentioned.
Check if the executable bit is set
The most common cause of exit code 126 is a missing execute permission on the file the shell tried to run.
ls -la ./script.shVerify the shebang interpreter exists
A script may have the executable bit but fail with code 126 if its first line points to an interpreter path that does not exist on this system.
head -n 1 ./script.shConfirm the target is a file, not a directory
Accidentally invoking a directory name as a command produces exit code 126 because a directory cannot be executed as a process.
file ./script.shCheck the binary architecture against the host
A compiled binary built for a different CPU architecture (for example, running an x86 binary on an ARM host) will fail with 126 because the kernel cannot execute the format.
file ./your_binary && uname -mRule out a noexec mount
A filesystem mounted noexec refuses execution regardless of permission bits, which produces 126 for every binary and script stored on it.
mount | grep noexec
Technical Background
When the shell runs a command, the file is loaded through the execve system call. If the call is refused because the execute bit is missing for the invoking user, the target is not a regular file such as a directory, a script's interpreter cannot be executed, or the filesystem is mounted noexec, the kernel reports EACCES. Bash's documented rule for a command that is found but not executable is return status 126.
The 126/127 pair comes straight from Bash's exit status rules: a command that cannot be found returns 127, and a command that is found but is not executable returns 126. The two statuses answer different questions, because 127 is about the name and 126 about the file the name resolved to.
126 sits among the values Bash reserves for special purposes: statuses above 125 are not meant for application exit codes, and a command killed by a fatal signal N returns 128+N. Ending a script with exit 126 or 127 invites confusion when troubleshooting, since the number reads as a launcher failure rather than the program's own result.
Common Causes
- The file lacks the execute permission bit, so the kernel refuses execution with EACCES
- The command names a directory, which is not a regular file and cannot be executed as a program
- A script's shebang line names an interpreter that is missing or not executable on this system
- The filesystem containing the file is mounted noexec, which refuses execution regardless of permission bits
Typical Scenarios
- A script downloaded straight from a repository or an archive has no execute bit yet, and running it fails before the script's first line executes
- A directory path is typed as if it were a command, for example ./scripts instead of ./scripts/build.sh, and the shell reports that the target is a directory
- A checkout or backup lives on a noexec-mounted partition, so every script and binary in it fails to launch regardless of permissions
- A scheduled job runs under a service account whose user has no execute permission on the script owned by someone else
What to Know
Run ls -l on the target and compare its mode and owner with the account that runs the command. If the bit is set, read the shebang line and confirm the interpreter path exists, then check whether the filesystem is mounted noexec. The file command helps distinguish a directory or a wrong-format file from a runnable program.
Frequently Asked Questions
Common questions about Linux 126 error
127 means the shell never found the command: no directory in $PATH holds an executable file by that name. 126 means the file was found but execution was refused, so the path is right and the problem sits in the file's permissions, its format, or how its filesystem is mounted.
The most common refusal is a missing execute bit: the kernel fails the exec call with EACCES when the invoking user is not allowed to execute the file. Comparing the account that runs the command with the mode string from ls -l resolves most cases, and EACCES is the same 'Permission denied' condition errno 13 reports for other system calls.
A directory is not a regular file, and the kernel refuses to execute anything that is not a regular file with EACCES. Because the shell did find the name, it reports 126 rather than the not-found 127.
Two frequent cases: the shebang line names an interpreter that is missing or not executable on this system, or the file sits on a filesystem mounted noexec, which refuses execution regardless of permission bits. Reading the first line and checking the mount options separates the two.
Related Error Codes
Related Errors From Other Categories
Similar error codes documented across different platforms and systems
The Docker CLI reached no daemon, so every command stops before doing any work.
The daemon answered, but the current Unix user lacks rights on the socket.
A newer client asked for an API version the connected daemon refuses to serve.
The registry refused the pull because the repository is private or unknown.