Skip to content
Latchkey

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

A level=error msg="Running error: ..." from golangci-lint is not a lint finding: the analysis driver could not load or compile your packages, so most linters cannot run at all.

What this error means

golangci-lint exits non-zero printing "level=error msg=\"Running error: context loading failed: ...\"" or a typecheck/build failure, with few or no normal lint issues listed.

golangci-lint
level=error msg="Running error: context loading failed: failed to load packages:
no Go files in /home/runner/work/app/app"
level=warning msg="Failed to run: ..."

Common causes

Packages fail to compile or load

golangci-lint type-checks the code first; a build error, a missing dependency, or the wrong working directory makes package loading fail.

A Go toolchain or module mismatch

The runner's Go version or module setup differs from what the code needs, so the loader cannot resolve packages.

How to fix it

Make the code build first

  1. Run go build ./... to confirm the packages compile.
  2. Fix the build error or run golangci-lint from the module root.
  3. Re-run the linter once go build is clean.
Terminal
go build ./...
golangci-lint run ./...

Match the Go version golangci-lint expects

Set up the Go version your modules require before linting so package loading succeeds.

.github/workflows/ci.yml
- uses: actions/setup-go@v5
  with:
    go-version: '1.22'

How to prevent it

  • Ensure go build ./... passes before running golangci-lint.
  • Run the linter from the module root with the right Go version.
  • Keep the linter's Go toolchain aligned with your modules.

Frequently asked questions

What causes ""level=error msg=\"Running error: ...\"""?
golangci-lint type-checks the code first; a build error, a missing dependency, or the wrong working directory makes package loading fail.
How do I fix "level=error msg=\"Running error: ...\""?
Make the code build first

Related guides

References

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