JuliusBrussee/caveman · error

native runtime named-pipe accept

Error message

native runtime named-pipe accept: %w

What it means

This error wraps a failure from listener.Accept() on the Windows named-pipe listener. Serve returns it only when the accept fails for a reason other than context cancellation or normal listener closure. It indicates the pipe server could not hand off an incoming connection.

Solutions

  1. Inspect the wrapped error with errors.Is/errors.As to identify the OS-level cause
  2. Ensure the listener is only closed via the ctx cancellation path (or that net.ErrClosed paths are respected)
  3. Restart the runtime server process if the pipe handle entered a broken state
  4. Check system logs for named-pipe/driver errors under load
Defensive patterns

Strategy: try-catch

Try / catch

if err := srv.Serve(ctx); err != nil {
    if errors.Is(err, net.ErrClosed) || ctx.Err() != nil { return nil }
    log.Printf("accept failed: %v", err)
    // restart server or surface to caller
}

Prevention

When it happens

Trigger: Accept returns an unexpected OS error during the accept loop — e.g. the pipe instance is in a broken state, the handle was closed unexpectedly by something other than the ctx listener.Close(), or a system-level pipe error occurs.

Common situations: External code closing the listener without cancelling ctx, resource exhaustion on the pipe handle, or driver/OS-level pipe corruption under heavy connection churn.

Understand the failure class

Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20). Data as JSON: /api/errors/7611c89d436bd3ac. Report an issue: GitHub.

Appendix: source

Thrown at proxy/internal/nativeruntime/server_windows.go:68

		SecurityDescriptor: sddl,
		InputBufferSize:    maxRequestBytes,
		OutputBufferSize:   maxRequestBytes,
	})
	if err != nil {
		return fmt.Errorf("native runtime named-pipe listen: %w", err)
	}
	defer listener.Close()
	go func() {
		<-ctx.Done()
		_ = listener.Close()
	}()
	for {
		conn, err := listener.Accept()
		if err != nil {
			if ctx.Err() != nil || errors.Is(err, net.ErrClosed) {
				return nil
			}
			return fmt.Errorf("native runtime named-pipe accept: %w", err)
		}
		go serveConn(ctx, conn, runtime)
	}
}

View on GitHub (pinned to 3ee70a1026)