Agent Job Failed with Exit Status 137
If an Agent Job fails with exit status 137, it usually indicates that the server ran out of available memory while executing the operation. This commonly occurs during memory-intensive tasks such as site migrations, restores, or updates.
Exit status 137 typically means the operating system terminated the process because the server did not have enough available memory (Out of Memory).
Example Error
Traceback (most recent call last):
File "/home/frappe/agent/repo/agent/base.py", line 50, in execute
output, returncode = self.run_subprocess(
File "/home/frappe/agent/repo/agent/base.py", line 103, in run_subprocess
raise subprocess.CalledProcessError(
subprocess.CalledProcessError: Command 'docker exec -w /home/frappe/frappe-bench bench-xxxxx-000xxxx-fxx-reg bench --site site.frappe.cloud migrate --skip-search-index --skip-failing' returned non-zero exit status 137.
Resolution
To prevent this error, upgrade your dedicated server to a plan with more memory. Additional RAM provides sufficient resources for memory-intensive operations such as migrations and restores, reducing the likelihood of processes being terminated.
If this error occurs repeatedly during migrations or other maintenance tasks, consider upgrading your server plan before retrying the operation to ensure adequate memory is available.