Skip to content
Latchkey

Go "test timed out after 10m0s" - Fix in CI

go test enforces a default 10-minute timeout per test binary. When a test hangs or runs long, the binary panics and dumps every goroutine so you can see what was stuck.

What this error means

A run fails with panic: test timed out after 10m0s followed by a goroutine dump. It means a test blocked on a channel, lock, or network call, or the suite genuinely needs more time.

go
panic: test timed out after 10m0s
	running tests:
		TestSyncWorkers (10m0s)

goroutine 42 [chan receive]:
	example.com/app.(*Worker).wait(...)

Common causes

A test hangs on a blocking operation

A goroutine is stuck on a channel, mutex, or network call that never completes, so the binary hits the timeout.

Suite legitimately exceeds 10 minutes

A large or slow suite needs more than the default timeout but was not given a higher -timeout.

How to fix it

Find the blocked goroutine

  1. Read the goroutine dump under the panic to find what is waiting.
  2. Add per-operation timeouts or context cancellation to the blocking call.

Raise the timeout for genuinely long suites

  1. Pass a higher -timeout only after confirming the suite is not hung.
.github/workflows/ci.yml
go test -timeout 20m ./...

How to prevent it

  • Use context with timeouts around I/O in tests.
  • Keep individual tests fast and well-bounded.
  • Reserve -timeout increases for suites that are genuinely long, not hung.

Related guides

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