Skip to content
Latchkey

golangci-lint "context deadline exceeded" - Fix in CI

golangci-lint aborts the whole run when its deadline passes. On a large module or a cold cache, the default timeout is often too short, so the run dies before finishing.

What this error means

golangci-lint exits with context deadline exceeded and no findings. The analysis took longer than the configured (or default 1m) timeout, usually on a cold cache.

go
level=error msg="Running error: context loading failed: ... context deadline exceeded"

Common causes

Timeout too low for the module

A big codebase with many analyzers exceeds the default one-minute budget.

Cold build/lint cache

Without a warm cache every package is analyzed from scratch, blowing the deadline.

How to fix it

Raise the timeout

  1. Give the run a larger deadline that fits the codebase.
.golangci.yml
run:
  timeout: 5m

Cache the analysis between runs

  1. Cache the Go build and golangci-lint caches so repeat runs are fast.
.github/workflows/ci.yml
- uses: actions/cache@v4
  with:
    path: ~/.cache/golangci-lint
    key: golangci-${{ hashFiles('**/go.sum') }}

How to prevent it

  • Set a realistic timeout in .golangci.yml.
  • Cache the lint and build caches across CI runs.
  • Disable redundant linters to cut analysis time.

Frequently asked questions

What causes ""context deadline exceeded""?
A big codebase with many analyzers exceeds the default one-minute budget.
How do I fix "context deadline exceeded"?
Raise the timeout

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card