Opyntel

Exit code 137 on Railway: why your service was killed, and how to see it coming

On Railway, exit code 137 almost always means the service went over its memory limit and was killed. The deployment shows as crashed. The logs end with Killed or Command failed with exit code 137, and Railway may flag that the deploy ran out of memory. For the general picture, see exit code 137 and OOM killed.

Why the graph looked fine

Railway’s Metrics tab samples memory over time, so a spike that lasts a few seconds can come and go between two points. Users on Railway Station often see 200 MB on the graph next to a 137, when the real peak was far higher. A crash with a calm graph points to a short spike: a batch job, a large upload, a build step or a burst of requests.

What sets the limit

Your plan sets the most memory each replica can use. Under the service’s Settings, Deploy, Replica Limits you can set a lower cap per replica, and each replica runs its own copy of the app.

How to fix it

  1. Find the peak. Set the Metrics tab to the hours before the crash, and look for climbs that never come back down.
  2. Cap the runtime. For Node, set NODE_OPTIONS=--max-old-space-size=<MB> to about 75 percent of the service’s memory, so the heap stays inside it.
  3. Cut workers. Lower WEB_CONCURRENCY or the Gunicorn worker count. Each worker holds its own copy of the app.
  4. Move heavy work out. Run batch jobs and imports in a separate worker service, so a spike there cannot take the web service down.
  5. Raise the limit, or upgrade the plan if the service has hit the plan’s ceiling.

What Railway warns you about

Railway’s monitors can alert on memory, but they need the Pro plan and are set up per environment. On Free, Trial and Hobby, nothing warns you before the kill. Project webhooks report the crashed deployment after it happens, one project at a time.

How Opyntel warns you first

Opyntel reads every Railway project with one token and shows memory as a share of each service’s limit. It alerts when a service’s memory passes your threshold, on any Railway plan, across every project and environment. Crashes and restarts land on one activity timeline, with an alert when a service goes down, by email, Slack or SMS depending on your plan.

One setup tip: set a replica memory limit on the services that matter. Without one, memory is measured against your plan’s ceiling, which is far above what a small service ever uses.

FAQ

Railway exit code 137 questions, answered

Restarts, build-time kills and crash alerts.

Yes. The default restart policy restarts on failure, up to 10 times, after which the service stays crashed. A leak shows as a crash every few hours until then.

The build ran out of memory, often in a bundler or the TypeScript compiler. Lower the build’s concurrency, or limit Node’s memory for the build command.

Railway can post crashes to Slack through a project webhook, after the fact. Opyntel alerts while memory is still climbing, for every project from one set of rules.

The alerts your platform doesn’t send.

One dashboard for everything you run, with the alerts your platforms leave out. Read-only, nothing to install in your apps.

See how it works