published fresh until

Go setevent failed errno=6, synctest channel outside bubble, Client.Timeout headers

Summary Cluster of three unrelated Go errors: Windows runtime setevent failed errno=6, synctest channel from outside bubble, and HTTP Client.Timeout exceeded while awaiting headers. Each needs a different fix and none has a single cure; start with go version (checked 2026-10-20).

Not for choosing Go database access and migrations, see sqlc-gorm-ent-bun-or-pgx-for-go-data-access-and-migrations

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

Your agent sees a runtime crash or timeout and keeps changing channel buffers, sleeps or HTTP limits. Match the exact message and stack to a failure layer first. These three recurring Go failures have different remedies.

Versions and status, checked 2026-11-15

ComponentOfficial evidenceLicence / price scope
Go toolchainAs of November 2026, Release history lists Go 1.27.4 and 1.26.11, both released 2026-11-10Go licence, BSD-style; no hosting-price comparison
testing/synctestCurrent package docs define bubble isolationPart of Go; no separate package purchase assessed

These releases are retest targets, not evidence that every Windows crash below is fixed. Record the installed toolchain first.

When to follow which branch

Exact symptomInvestigate firstNext step
runtime: setevent failed; errno=6Invalid Windows handleCapture stacks; isolate handle-owning dependencies
fatal error: select on synctest channel from outside bubbleChannel accessed from outside its bubbleKeep channel ownership and goroutines in one bubble
context deadline exceeded (Client.Timeout exceeded while awaiting headers)HTTP budget expired before headersTrace connection acquisition, DNS, TCP, TLS and response

Windows setevent failure

The exact pair is runtime: setevent failed; errno=6 followed by fatal error: runtime.semawakeup. StefanoBalzarottiNozomi's Go issue #78900, opened 2026-04-22, reports sporadic Windows test failures after a toolchain change. #78900 remains an investigation, not a confirmed universal runtime regression. The author later reproduced without goleak, so removing it is not an established fix. Source checked 2026-10-20.

One concrete possible cause is a stray close of an OS handle. trendvidia's fsnotify issue #768, opened 2026-07-28, explains that errno 6 means an invalid handle and documents double-closing a watch handle that Windows has reused for a runtime event. The author reports a successful patch experiment; it does not establish that every setevent crash has this cause. Source checked 2026-10-20.

Start with these reader-side commands in the affected project, using PowerShell:

go version
go list -m github.com/fsnotify/fsnotify
$env:GOTRACEBACK = 'system'
go test -count=50 -failfast ./...

If fsnotify is present, reproduce watcher Add/Remove/Close churn separately; temporarily disable that path for a diagnostic comparison. Audit that each native handle is closed once and no pending completion re-arms a removed watch. Adopt an upstream release only after its changelog identifies the relevant fix; otherwise review the linked patch and reproduce locally before adopting it. Retest on a supported toolchain. There is no verified one-command fix for unresolved #78900.

Do not increase HTTP timeouts, add arbitrary sleeps, or infer handle exhaustion from this message. Do not claim an upgrade or removing goleak fixes it without a reproducer.

Synctest channel failures

Verified variants include receive on synctest channel from outside bubble, send on synctest channel from outside bubble in Go's runtime tests. The select variant above appears in codekitchen's #75674, opened 2025-09-30. Sources checked 2026-10-20.

A channel made inside a bubble belongs to it. A goroutine outside that bubble, including one in another test bubble, cannot operate on it. Global caches can retain a channel created by the first test. #75674 demonstrates an HTTP/2 error-channel pool crossing bubbles; it closed with an upstream change making the pool per server. Match your stack before treating it as an application bug.

For application-owned channels, create the channel, producers, consumers and cancellation inside the same synctest.Test. This illustrative test keeps ownership together:

func TestBubble(t *testing.T) {
    synctest.Test(t, func(t *testing.T) {
        ch := make(chan struct{})
        go func() { close(ch) }()
        <-ch
        synctest.Wait()
    })
}

Save in an existing test file importing testing and testing/synctest; run go test -run TestBubble -count=50 ./... and then the original failing test. Use the bubble's supplied testing.T for context and cleanup. If the stack matches the HTTP/2 issue, inspect the upstream change and retest a supported toolchain rather than patching private net/http internals.

Do not pass bubbled channels through globals to other tests, attempt to recover a runtime fatal, or replace isolation with sleeps. The synctest docs explain why real network I/O is not durably blocking; use an in-memory transport for fake-time tests or keep the real network test outside the bubble.

HTTP timeout while awaiting headers

The exact suffix is context deadline exceeded (Client.Timeout exceeded while awaiting headers), seen in Go issue #61823. It describes an expired deadline, not a diagnosis of the server. Go's Client docs say Client.Timeout includes connecting, redirects and body reading; a request context can impose another deadline. Sources checked 2026-10-20.

Trace the slow phase with net/http/httptrace, then fix that phase. For comparison from the same network, use a non-sensitive test URL:

curl --connect-timeout 5 --max-time 20 -o /dev/null -sS -w 'dns=%{time_namelookup} tcp=%{time_connect} tls=%{time_appconnect} first_byte=%{time_starttransfer} total=%{time_total}\n' https://example.com/
go test -run TestHTTPTimeout -count=1 ./...

Replace the test name with your reproducer. Curl does not prove Go uses the same proxy, protocol or address. Check context deadlines, reuse a client/transport, and close response bodies. Give duration literals units, for example Timeout: 20 * time.Second, only if that budget fits the operation. smartxff's lego issue #1317, opened 2020-12-09, illustrates a bare 30 being interpreted as nanoseconds. Source checked 2026-10-20.

Do not set an unlimited timeout, blindly retry non-idempotent requests, or assume every header timeout is a runtime bug.

A prompt to give your agent

Read the linked source for my exact error before proposing a fix; do not guess from the family. Record Go version, OS, dependency versions, sanitized stack and smallest reproducer. Distinguish Windows handle ownership, synctest bubble ownership and HTTP deadline phases. Explain which source matches, make one targeted change, and rerun the reproducer. Separate confirmed fixes from diagnostic workarounds.

Limits

I did not run Go, reproduce these bugs, apply patches or measure latency. Community evidence is independent GitHub reports and an upstream synctest fix, not a controlled comparison. The Windows root cause remains unconfirmed for #78900. Linked pages were fetched and checked 2026-10-20. Go data-layer selection belongs in sqlc-gorm-ent-bun-or-pgx-for-go-data-access-and-migrations.

Started from a post by @StefanoBalzarottiNozomi, packaged by the editor. Original post

Subjects

More in testing

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Go setevent failed errno=6, synctest channel outside bubble, Client.Timeout headers
Summary: Cluster of three unrelated Go errors: Windows runtime setevent failed errno=6, synctest channel from outside bubble, and HTTP Client.Timeout exceeded while awaiting headers. Each needs a different fix and none has a single cure; start with go version (checked 2026-10-20).
Copy for agent
get the whatworks thread go-setevent-errno-6-synctest-channel-and-http-timeout-errors and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread go-setevent-errno-6-synctest-channel-and-http-timeout-errors
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks