Azure Pipelines "ran longer than the maximum time" Timeout
By Kaveh Alemi·Latchkey
The job exceeded its configured (or default) maximum time, so Azure Pipelines canceled it. The work was still running when the limit hit.
What this error means
The job is canceled with "The job running on agent X ran longer than the maximum time of N minutes." It often only happens on slow runs.
azure-pipelines
##[error]The job running on agent Hosted Agent ran longer than themaximum time of 60 minutes. For more information, see https://go.microsoft.com/fwlink
Diagnose it: variables, expressions, or the agent?
Azure Pipelines resolves compile-time expressions (${{ }}) before the run and runtime expressions ($[ ]) during it. Using the wrong one is the most common source of a value that is empty when you read it.
azure-pipelines.yml
# print what the job actually resolved- script:|echo "reason:$(Build.Reason)"echo "branch:$(Build.SourceBranch)"env | sort | head -40displayName:Dump context# enable full diagnostics on a run: set system.debug = true as a variable
Common causes
Work genuinely too slow
A build or test step ran past the limit on a slow agent or under load.
A hung step
A command waiting on input or deadlocked never returns.
Limit set too low
timeoutInMinutes does not allow headroom for variance.
How to fix it
Raise or scope the timeout
Set a realistic timeoutInMinutes on the job.
Split very long jobs into stages.
azure-pipelines.yml
jobs:- job:integrationtimeoutInMinutes:90
Remove hangs
Run commands non-interactively and add per-step timeouts.
How to prevent it
If you run on GitHub Actions, self-healing managed runners such as Latchkey auto-retry transient failures, so a one-off slow run does not fail the job. On Azure DevOps, right-size timeoutInMinutes per job.
Frequently asked questions
What causes Azure Pipelines "ran longer than the maximum time" timeout?
There are 3 common causes: work genuinely too slow, a hung step, and limit set too low. A build or test step ran past the limit on a slow agent or under load.
How do I fix Azure Pipelines "ran longer than the maximum time" timeout?
There are 2 fixes depending on which cause you have: raise or scope the timeout and remove hangs. Work through them in order, since the first is the most common.
What does Azure Pipelines "ran longer than the maximum time" timeout actually mean?
The job is canceled with "The job running on agent X ran longer than the maximum time of N minutes." It often only happens on slow runs.
How do I stop Azure Pipelines "ran longer than the maximum time" timeout happening again?
If you run on GitHub Actions, self-healing managed runners such as Latchkey auto-retry transient failures, so a one-off slow run does not fail the job.