---
title: How can I set a custom build timeout?
description: Wrap your Vercel build command with the timeout command to ensure builds terminate gracefully before exceeding Vercel’s maximum build duration.
url: "https://vercel.com/kb/guide/custom-build-timeout"
published: 2025-11-03
last_updated: 2026-10-16
authors: Andrew Healey
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---

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`

## More Next.js guides

- [Troubleshooting Build Error: "Build step did not complete within the maximum of 45 minutes"](/kb/guide/troubleshooting-build-error-build-step-did-not-complete-within-45-minutes): Learn common reasons Vercel builds hit the 45-minute limit and how to reduce build times so your deployments stay fast and reliable.
- [Troubleshooting Builds Failing with SIGKILL or Out of Memory Errors](/kb/guide/troubleshooting-sigkill-out-of-memory-errors): Learn how to troubleshoot builds failing with SIGKILL or Out of Memory errors on a Vercel Deployment.
- [Encrypting parameters](/kb/guide/encrypting-parameters): Learn how to encrypt parameters so that only certain values can be passed to generate your image.