{"record":{"id":"5cda62458b8773df","repo":"JuliusBrussee/caveman","slug":"native-runtime-named-pipe-listen-w","errorCode":null,"errorMessage":"native runtime named-pipe listen: %w","messagePattern":"native runtime named-pipe listen: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/internal/nativeruntime/server_windows.go","lineNumber":55,"sourceCode":"func Serve(ctx context.Context, home string, runtime *Runtime) error {\n\tif runtime == nil || runtime.store == nil {\n\t\treturn errors.New(\"native runtime: store is required\")\n\t}\n\tuser, err := windows.GetCurrentProcessToken().GetTokenUser()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"native runtime current user SID: %w\", err)\n\t}\n\tif user == nil || user.User.Sid == nil {\n\t\treturn errors.New(\"native runtime current user SID: unavailable\")\n\t}\n\tsddl := \"D:P(A;;GA;;;\" + user.User.Sid.String() + \")\"\n\tlistener, err := winio.ListenPipe(SocketPath(home), &winio.PipeConfig{\n\t\tSecurityDescriptor: sddl,\n\t\tInputBufferSize:    maxRequestBytes,\n\t\tOutputBufferSize:   maxRequestBytes,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"native runtime named-pipe listen: %w\", err)\n\t}\n\tdefer listener.Close()\n\tgo func() {\n\t\t<-ctx.Done()\n\t\t_ = listener.Close()\n\t}()\n\tfor {\n\t\tconn, err := listener.Accept()\n\t\tif err != nil {\n\t\t\tif ctx.Err() != nil || errors.Is(err, net.ErrClosed) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"native runtime named-pipe accept: %w\", err)\n\t\t}\n\t\tgo serveConn(ctx, conn, runtime)\n\t}\n}\n","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/proxy/internal/nativeruntime/server_windows.go#L37-L73","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if runtime.GOOS != \"windows\" { return errors.New(\"named-pipe runtime requires windows\") }\npipePath := nativeruntime.SocketPath(home)\nif pipePath == \"\" || strings.ContainsAny(pipePath, \"\\x00\") { return fmt.Errorf(\"invalid pipe path %q\", pipePath) }","typeGuard":null,"tryCatchPattern":"err := srv.Serve(ctx)\nvar pe *winio.ErrPipeListen // or inspect wrapped error\nif err != nil {\n    if errors.Is(err, context.Canceled) { return nil }\n    log.Printf(\"named-pipe listen failed: %v\", err) // inspect %w cause\n}","preventionTips":["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"],"tags":["windows","named-pipe","network"],"backgroundTag":"connection-refused","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}