Skip to content
Latchkey

golangci-lint "level=error msg='Running error'" - Fix in CI

golangci-lint did not just report findings - a linter failed to run. A Running error means the code did not typecheck, a sub-linter crashed, or the config/tool setup is wrong, so the run aborts before producing normal results.

What this error means

golangci-lint exits nonzero with a level=error msg="Running error" line, often citing a typecheck failure or a linter that could not load the packages. This is distinct from ordinary lint findings - the run itself broke.

golangci-lint output
level=error msg="Running error: context loading failed: failed to load packages:
	internal/api/client.go:9:2: could not import github.com/org/missing (...)"
level=error msg="Running error: buildir: analysis skipped: errors in package"

Common causes

The code does not typecheck

Many linters need to load and typecheck packages. A build/import error (a missing dependency, a compile error) makes that load fail, so the linter cannot run.

A missing dependency or wrong working directory

If modules are not downloaded or the lint runs from the wrong directory, package loading fails with a running error.

A misconfigured linter or version mismatch

A .golangci.yml referencing an unknown linter, or a golangci-lint version incompatible with the Go toolchain, can abort the run.

How to fix it

Make the code build first

A clean build (and downloaded modules) is a prerequisite for linting - fix compile/import errors before linting.

Terminal
go mod download
go build ./...    # must pass before lint can load packages
golangci-lint run ./...

Align golangci-lint with your toolchain

  1. Pin a golangci-lint version compatible with your Go version.
  2. Validate the config with golangci-lint config verify (or golangci-lint linters).
  3. Run from the module root so package loading succeeds.

How to prevent it

  • Ensure go build ./... passes before the lint step runs.
  • Pin compatible golangci-lint and Go versions in CI.
  • Validate .golangci.yml so unknown linters do not abort the run.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →