Skip to content

Build Timeout

Error message

                Error: The job was canceled because it exceeded the maximum timeout
              

Quick summary

The build or test step exceeds the configured timeout, causing the CI system to cancel it.

Why this happens

  • The build is genuinely slow (large codebase, heavy compilation)

  • A step is hanging — waiting for input, a network resource, or a lock

  • The timeout is set too low for the workload

  • Resource constraints (low CPU, memory) make the build slow

Minimal example

✗ Broken code
jobs:
  build:
    runs-on: ubuntu-latest
    timeout-minutes: 5  # too short for large build
✓ Fixed code
jobs:
  build:
    runs-on: ubuntu-latest
    timeout-minutes: 30  # more realistic

The 5-minute timeout is too short for the build. The fix increases it to 30 minutes.

How to diagnose

  • Check the pipeline logs for how far the build got before timing out

  • Review the timeout configuration for the job

  • Check if the build is hanging on a specific step (network, dependency download)

  • Compare build times with previous successful runs

How to fix

  • Increase the timeout for the job in the pipeline configuration

  • Optimize the build (caching, parallel steps, reduce scope)

  • Fix the hanging step (add timeouts to network calls, fix deadlocks)

  • Allocate more resources (CPU, memory) to the CI runner

How to prevent

  • Set reasonable timeouts based on historical build times

  • Use caching to speed up builds (dependencies, build artifacts)

  • Monitor build times and alert on increasing trends

Related Resources

Related Glossary

← Back to language