JuliusBrussee/caveman · error
native runtime named-pipe listen
Error message
native runtime named-pipe listen: %w
What it means
This error wraps a failure from winio.ListenPipe when the native runtime server tries to create its Windows named-pipe listener. It means the pipe could not be created with the requested security descriptor or buffer sizes, so Serve aborts before accepting any connections. The underlying OS error is preserved via %w for errors.Is/As inspection.
Solutions
- Check the wrapped error for the root cause (e.g. pipe already exists or invalid SDDL) using errors.Is/errors.As
- Ensure any previous instance of the runtime is stopped so the pipe name is free
- Validate the SDDL security descriptor string references valid SIDs and grants the intended access
- Verify SocketPath(home) produces a valid pipe name for the home directory
- Run under an account with permission to create named pipes in the requested namespace
Defensive patterns
Strategy: try-catch
Validate before calling
if runtime.GOOS != "windows" { return errors.New("named-pipe runtime requires windows") }
pipePath := nativeruntime.SocketPath(home)
if pipePath == "" || strings.ContainsAny(pipePath, "\x00") { return fmt.Errorf("invalid pipe path %q", pipePath) } Try / catch
err := srv.Serve(ctx)
var pe *winio.ErrPipeListen // or inspect wrapped error
if err != nil {
if errors.Is(err, context.Canceled) { return nil }
log.Printf("named-pipe listen failed: %v", err) // inspect %w cause
} Prevention
- Stop previous runtime instances before starting a new one
- Validate SDDL descriptors reference well-known SIDs
- Test pipe name derivation from the home directory path
- Ensure the service account can create named pipes
When it happens
Trigger: Calling Serve on Windows when the named pipe path (SocketPath(home)) is invalid, another pipe already exists with a conflicting name, or the SDDL security descriptor string is malformed or denies pipe creation.
Common situations: Stale pipe from a previous unclean shutdown, running under a service account whose SDDL references unknown SIDs, or a home directory path with characters invalid for pipe names.
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
- native runtime current user SID: unavailable
- native runtime current user SID
- native runtime named-pipe accept
- native runtime: store is required
- AbortError
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/5cda62458b8773df.
Report an issue: GitHub.
Appendix: source
Thrown at proxy/internal/nativeruntime/server_windows.go:55
func Serve(ctx context.Context, home string, runtime *Runtime) error {
if runtime == nil || runtime.store == nil {
return errors.New("native runtime: store is required")
}
user, err := windows.GetCurrentProcessToken().GetTokenUser()
if err != nil {
return fmt.Errorf("native runtime current user SID: %w", err)
}
if user == nil || user.User.Sid == nil {
return errors.New("native runtime current user SID: unavailable")
}
sddl := "D:P(A;;GA;;;" + user.User.Sid.String() + ")"
listener, err := winio.ListenPipe(SocketPath(home), &winio.PipeConfig{
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)