Slurm job failed: how to find out why and fix it
Updated · Scientifically reviewed by Dinkar Mishra, PhD on
Short answer
Run sacct -j JOBID --format=JobID,State,ExitCode,Elapsed,MaxRSS,ReqMem,NodeList and read the State and ExitCode of each job step. OUT_OF_MEMORY means raise --mem or reduce memory use; TIMEOUT means raise --time or checkpoint; exit code 127 means a command was not found (usually a missing module); 137 is a kill signal (often memory); 139 is a segmentation fault in your program. The job's output file then shows the exact error.
Who this is for
Cluster users whose simulation or analysis job ended with FAILED, OUT_OF_MEMORY, TIMEOUT or no output, and the support staff helping them.
Software
Slurm ≥ 22.05
Symptoms
squeueno longer lists the job, and the results are missing or incomplete.sacctshowsFAILED,OUT_OF_MEMORY,TIMEOUT,NODE_FAILorCANCELLED.- The output file is empty or does not exist.
- An email from Slurm reports a failure.
Diagnosis
1. Read the state and exit code of every step.
sacct -j 812345 --format=JobID,JobName%20,State,ExitCode,Elapsed,Timelimit,MaxRSS,ReqMem,NodeList
Each job has a batch step (your script) and one step per srun. The failing step tells you where it went wrong. ExitCode has the form code:signal.
2. Read the job’s output and error files. Their names come from --output/--error. The default is slurm-JOBID.out in the submission directory. The last lines usually contain the real error.
tail -n 50 slurm-812345.out
3. Match what you found to the table below.
| What you see | Most likely cause |
|---|---|
State=OUT_OF_MEMORY, or oom-kill in the output | The job exceeded --mem / --mem-per-cpu and the kernel killed it. |
State=TIMEOUT | The job reached its --time limit. |
ExitCode=127:0, “command not found” | A program or module is not available on the compute node. |
ExitCode=137 or signal 9 | The process was killed (SIGKILL): very often memory, sometimes the time limit. |
ExitCode=139 or signal 11 | Segmentation fault: a bug, an array overrun, a too-small stack, or a library/ABI mismatch. |
ExitCode=1:0 with a Python traceback | An exception in your code or input files. |
State=NODE_FAIL | A compute node failed. Not your fault; resubmit. |
| No output file at all | The --output directory did not exist, or the file system was full/unavailable. |
State=CANCELLED by NNNN | Cancelled by a user ID: you, or an administrator (check sacct -o Reason). |
Exit codes above 128 encode a signal: code = 128 + signal number, so 137 = 128 + 9 (SIGKILL) and 139 = 128 + 11 (SIGSEGV).
Fixes
Out of memory. Compare MaxRSS with ReqMem. Increase memory moderately, or use more tasks so each holds less data:
#SBATCH --mem=16G # per node
# or, for MPI codes, memory per allocated CPU:
#SBATCH --mem-per-cpu=4G
If memory grows during the run, check for leaks or large in-memory output buffers. Write data incrementally instead.
Timeout. Raise --time up to the partition limit (sinfo -o "%P %l"). For longer runs, use your code’s checkpoint/restart feature and chain jobs with --dependency=afterany.
Command not found (127). Load modules and activate environments inside the script, not only on the login node:
set -euo pipefail
module purge
module load gcc/12 openmpi/4.1 hdf5
source "$HOME/venvs/sim/bin/activate"
which python # record which interpreter was used
Segmentation fault (139). Rebuild with debug flags (-g -O0) and run a small case. Check the stack limit for Fortran codes (ulimit -s unlimited inside the script). Make sure the code was compiled with the same compiler and MPI library that you load at run time.
No output file. Create the log directory before submitting (mkdir -p logs). Check quota with your site’s quota command, or df -h on the target file system.
Script reported success but something failed. Add set -euo pipefail after the #SBATCH lines, so the first failing command ends the job with a non-zero exit code.
When to get help
Ask your HPC support team, or us, when:
- jobs fail with
NODE_FAILrepeatedly on the same node; - you see MPI or InfiniBand errors (for example
UCX,PMIxoribv_messages) that appear only at scale; - a segmentation fault disappears in debug builds, which suggests a memory-corruption bug.
Send the job script, the full output file and the sacct line.
Assumptions and limitations
- Signal and exit-code conventions are those of Linux and bash. Some programs use their own exit codes, so check their documentation.
- How memory limits are enforced (cgroups, accounting polling) depends on the site’s Slurm configuration, which affects whether a job is marked
OUT_OF_MEMORYor simplyFAILEDwith signal 9. seffis a contributed tool and is not installed on every cluster.
Frequently asked questions
What does ExitCode 0:9 or 0:15 mean in sacct?+
The number after the colon is the signal that terminated the process. 9 is SIGKILL (often the out-of-memory killer, or a time limit enforcement) and 15 is SIGTERM (Slurm asking the job to stop, for example at the time limit or after scancel).
My job is COMPLETED but the results are wrong or missing. Why?+
Slurm only records the exit status of the batch script. If a command fails but the script carries on, the final command can still exit 0. Add set -euo pipefail near the top of your script so the job stops and is marked FAILED at the first error.
How do I see the memory a job actually used?+
sacct reports MaxRSS per job step (the batch step and each srun step), and seff JOBID summarises efficiency where installed. For running jobs, sstat -j JOBID --format=MaxRSS,AveCPU shows live usage.
Can I get emailed when a job fails?+
Yes, if your site allows it: add #SBATCH --mail-type=FAIL,TIME_LIMIT and #SBATCH --mail-user=you@institute.edu to the script.
References
- Job exit codes · SchedMD (official Slurm documentation)
- sacct manual (job states and fields) · SchedMD
- sbatch manual (--output, --mem, --time) · SchedMD
- Bash Reference Manual: exit status · GNU
Still stuck?
Send us the error output and your job script. A computational scientist will diagnose it, usually within a day.
Services listed on this page are available today. Products marked “early access” or “in development” on our platform page are not yet generally available.
Spotted an error or an outdated command? Tell us. We correct verified issues promptly.