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
- Read the goroutine dump under the panic to find what is waiting.
- Add per-operation timeouts or context cancellation to the blocking call.
Raise the timeout for genuinely long suites
- 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
-timeoutincreases for suites that are genuinely long, not hung.
Related guides
Go "panic: runtime error" during test - Fix in CIFix Go "panic: runtime error" during a test in CI - a nil dereference, index out of range, or similar runtime…
Go "all goroutines are asleep - deadlock" in test - Fix in CIFix Go "fatal error: all goroutines are asleep - deadlock!" during a test in CI - every goroutine is blocked.…
Go "go test: exit status 2" - Fix in CIFix Go "go test ... exit status 2" in CI - a build or tooling failure, not a test assertion, ended the run. R…