# How can I set a custom build timeout?

**Author:** Andrew Healey 

---

To kill builds before they timeout due to Vercel’s [maximum build duration](https://vercel.com/docs/limits/overview#build-time-per-deployment), wrap the existing build command with the [timeout](https://man7.org/linux/man-pages/man1/timeout.1.html) command. This method ensures that your builds are terminated gracefully, preventing unnecessary resource usage.

## 1\. Identify Your Build Command

The existing build command can be found via [Build and Deployment Settings](https://vercel.com/docs/deployments/configure-a-build#build-command), or the `buildCommand` value in a previously configured [vercel.json](https://vercel.com/docs/projects/project-configuration#buildcommand) file.

If you haven’t set one, it will be your framework’s default build command.

## 2\. Modify the Build Command

To set a custom build timeout, modify your build command to include the timeout command followed by the desired time limit. The syntax for the timeout command is:

`timeout [DURATION] [COMMAND]`

DURATION is a floating point number with an optional suffix: 's' for seconds (the default), 'm' for minutes, 'h' for hours or 'd' for days. A duration of 0 disables the associated timeout.

To set a 15-minute timeout for a Next.js build, your modified build command would be:

`timeout 15m next build`

## 3\. Observe the Result

The next time your build command runs for longer than this duration, it will receive a 124 exit status, which looks like this in your build log:

`Error: Command "timeout 15m next build" exited with 124`

---

[View full KB sitemap](/kb/sitemap.md)
