Home›DevOps›AutoSys Exit Code 127: Works in Your Terminal, Fails in AutoSys
Intermediate
3 min · November 07, 2026
AutoSys Exit Code 127: Works in Your Terminal, Fails in AutoSys
AutoSys exit code 127 means command not found: the job's shell searched PATH and didn't find the command, usually because the job doesn't load your login.
N
NarenFounder & Principal Engineer
20+ years shipping production infrastructure and CI/CD at scale. Drawn from code that ran under real load.
Fix: set the job's profile attribute to a file that exports the environment, or call commands by full path.
Also check for typos, relative paths (./run.sh), and that the job's owner is the user you tested as.
126 is different: the file was found but isn't executable (chmod +x).
✦ Definition~90s read
What is AutoSys Exit Code 127?
Exit code 127 is the shell's 'command not found'. In AutoSys it nearly always means the job's environment is different from your terminal's: the job doesn't run your login profile, so PATH and variables like ORACLE_HOME are missing, and the command can't be found.
★
Your terminal is your desk, with every tool laid out.
Plain-English First
Your terminal is your desk, with every tool laid out. An AutoSys job starts at an empty desk. It asks for sqlplus, nobody put it there, and the shell says "never heard of it": exit 127.
The job fails in two seconds with exit code 127. You log in, run the exact same command, and it works. Nothing is wrong with the script: the job just doesn't get the environment your terminal has. This guide shows why, how to reproduce the failure in seconds, and the two clean fixes.
What Exit Code 127 Means
When a shell is asked to run a command without a full path, it looks in each folder listed in PATH, left to right. If none of them has it, the shell prints 'command not found' and exits with 127. AutoSys just reports that code. So 127 tells you the command was never started.
FIN_LOAD 11/07/2026 01:30:00 11/07/2026 01:30:02 FA Xit 127
/apps/fin/bin/load.sh: line 4: sqlplus: command not found
🎯 Key Takeaway
127 = the shell searched PATH and found nothing.
Why It Works in Your Terminal
Your terminal ran your login profile when you logged in, and that profile added folders to PATH and set variables like ORACLE_HOME. An AutoSys job is started by the agent, not by a login, so none of that runs. The job gets a short default PATH and none of your variables.
compare.shBASH
1
2
3
4
5
6
7
# Your terminal
echo $PATH
# /usr/local/bin:/usr/bin:/bin:/u01/oracle/bin
# What a job gets (no profile)
env -i /bin/sh -c 'echo $PATH'
# /usr/bin:/bin
🎯 Key Takeaway
Jobs don't get your login profile.
Reproduce It in Seconds
Don't rerun the job to test a fix. Start a shell with an empty environment, as the job's owner, and run the command. If it fails here, it fails in AutoSys; when it works here, it will work there.
reproduce.shBASH
1
sudo -u batch env -i /bin/sh -c 'sqlplus -v'
Output
sh: sqlplus: command not found
💡Test the fix the same way
Run env -i /bin/sh -c '. /apps/fin/env/oracle.env; sqlplus -v' to prove the profile works before you change the job.
🎯 Key Takeaway
env -i as the job owner reproduces the job's environment.
Fix 1: Give the Job a Profile
The profile attribute names a file that AutoSys sources before running the command. Put the exports the job needs in it. This keeps the environment in one place for every job that needs the same tools.
profile: makes the environment explicit and shared.
Fix 2: Use Full Paths
For a single command, calling it by its full path removes the PATH search entirely. Inside scripts, set PATH at the top rather than relying on whoever starts the script.
Exit 126 means the file was found but couldn't be executed. Check chmod +x and that the job's owner can read and run it.
🎯 Key Takeaway
A full path can't be missing from PATH.
● Production incidentPOST-MORTEMseverity: high
It Works When I Run It
Symptom
FIN_LOAD failed after 2 seconds with exit code 127. The error file said: sqlplus: command not found.
Assumption
Because the command worked when the developer ran it, the team assumed a transient problem and kept rerunning the job.
Root cause
sqlplus lived in /u01/oracle/bin, which the developer's .bash_profile added to PATH. The AutoSys job didn't run that profile, so its PATH was only /usr/bin:/bin.
Fix
Created /apps/fin/env/oracle.env exporting ORACLE_HOME and PATH, and set profile: /apps/fin/env/oracle.env on the job. Tested first with env -i as the job's owner.
Key lesson
127 means command not found, not a bug in the script.
Jobs don't get your login profile.
Reproduce with an empty environment before changing anything.
Production debug guideFind the missing command5 entries
Symptom · 01
Works in your terminal, fails in AutoSys
→
Fix
The job lacks your profile. Compare echo $PATH in your shell with the job's environment (print env in a test job).
Symptom · 02
Error says 'command not found'
→
Fix
Run which COMMAND in your shell to find its folder, then check that folder is in the job's PATH.
Symptom · 03
Command is ./something
→
Fix
Relative paths depend on the working directory. Use the full path.
Symptom · 04
Works as you, fails as the job
→
Fix
Check the job's owner attribute and test as that user with sudo -u OWNER.
Symptom · 05
Exit 126 instead
→
Fix
The file exists but isn't executable or the owner can't run it. chmod +x and check permissions.
⚙ Quick Reference
5 commands from this guide
File
Command / Code
Purpose
check.sh
autorep -J FIN_LOAD -d
What Exit Code 127 Means
compare.sh
echo $PATH
Why It Works in Your Terminal
reproduce.sh
sudo -u batch env -i /bin/sh -c 'sqlplus -v'
Reproduce It in Seconds
fin_load.jil
update_job: FIN_LOAD
Fix 1
load.sh
export ORACLE_HOME=/u01/oracle
Fix 2
Key takeaways
1
Exit 127 means command not found.
2
AutoSys jobs don't run your login profile.
3
Reproduce with env -i as the job's owner.
4
Fix with the profile attribute or full paths.
5
126 means found but not executable.
Common mistakes to avoid
3 patterns
×
Rerunning and hoping
Symptom
127 every time.
Fix
It's deterministic. Reproduce with env -i and fix the environment.
×
Testing as yourself
Symptom
Works for you, fails for the job.
Fix
Test as the job's owner with sudo -u OWNER.
×
Relative commands
Symptom
./run.sh works from your home folder only.
Fix
Use full paths in the command attribute.
INTERVIEW PREP · PRACTICE MODE
Interview Questions on This Topic
Q01SENIOR
A job fails with exit code 127 but the command works from your terminal....
Q02JUNIOR
What's the difference between exit codes 126 and 127?
Q01 of 02SENIOR
A job fails with exit code 127 but the command works from your terminal. Why?
ANSWER
127 is command not found. The job doesn't source your login profile, so its PATH is missing the folder. Use the profile attribute or full paths.
Q02 of 02JUNIOR
What's the difference between exit codes 126 and 127?
ANSWER
127: the command wasn't found. 126: it was found but couldn't be executed, usually permissions.
01
A job fails with exit code 127 but the command works from your terminal. Why?
SENIOR
02
What's the difference between exit codes 126 and 127?
JUNIOR
FAQ · 3 QUESTIONS
Frequently Asked Questions
01
What does exit code 127 mean in AutoSys?
The shell couldn't find the command the job tried to run, usually because the job's PATH is missing a folder.
Was this helpful?
02
Why does my command work in the terminal but not in AutoSys?
Your terminal ran your login profile; the job didn't. Its PATH and variables are different.
Was this helpful?
03
How do I set environment variables for an AutoSys job?
Put the exports in a file and point the job's profile attribute at it, or set them at the top of the script.