Linux system errors

Command Not Executable

126
MediumLinux System

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 'x' (executable) permission bit.

Exit code 126 occurs when the shell locates the file you specified, but the system refuses to run it as a process. This is distinct from error 127 where the file isn't found at all.

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.

  1. 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.sh
  2. Verify 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.sh
  3. Confirm 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.sh
  4. Check 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 -m

Technical Background

Exit code 126 is specific to situations where the shell successfully found the file but the 'exec' system call failed. This usually happens when you try to run a script that doesn't have the executable bit set, or when you try to execute a directory.

It can also occur if the file is a binary for a different CPU architecture (e.g., trying to run an x86 binary on an ARM system) or if the dynamic linker cannot find the required shared libraries.

Common Causes

  • The file lacks the 'x' (executable) permission bit
  • The file is a directory but was invoked as a command
  • The file format is not recognized by the operating system

Typical Scenarios

  • Trying to run a script that was just downloaded without setting permissions
  • Accidentally typing a directory name into the terminal prompt

What to Know

Ensuring the presence of the executable permission bit (chmod +x) and verifying the shebang interpreter path (e.g., #!/bin/bash) are the standard fixes for code 126. Verification of the target binary architecture against the host system is also recommended.

Frequently Asked Questions

Common questions about Linux 126 error

Verify the file is not a directory and use 'chmod +x filename' to make it executable.

Related Error Codes

Related Errors From Other Categories

Similar error codes documented across different platforms and systems