0X000000E6

ERROR_BAD_PIPE 0xE6: Pipe State Invalid Fix

Windows Errors Intermediate 👁 0 views 📅 May 26, 2026

This error means a named pipe connection got corrupted mid-communication. Usually happens with SQL Server, remote WMI queries, or custom service-to-service apps.

When This Error Hits

You're running a SQL Server maintenance script, querying WMI remotely with PowerShell, or a custom service is talking to another over named pipes. Then boom — the app throws 0x000000E6 (ERROR_BAD_PIPE). The pipe state is invalid. The connection was working a second ago, but now it's dead. I've seen this most often with SQL Server when named pipes protocol is enabled and the server restarts or the SPN gets messed up. Also happens with WMI when you're hammering it with multiple queries too fast.

Root Cause

The culprit here is almost always a broken or abandoned named pipe. Named pipes are half-duplex or duplex communication channels between processes — one side writes, the other reads. When something kills the pipe mid-stream (service restart, network blip, resource starvation), the pipe goes into an inconsistent state. The OS can't recover it automatically. The error code 0xE6 means the pipe's internal state machine got confused — it's not ready to read or write anymore.

Common Triggers

  • SQL Server named pipes enabled but TCP/IP also vying for the same connection
  • WMI queries from multiple threads hitting the same namespace
  • A firewall rule blocking or delaying pipe traffic
  • Antivirus scanning pipe endpoints (yes, I've seen this)

Fix It in 5 Steps

Skip the registry tweaks — they rarely help. The fix is about clearing the broken pipe and restarting the service cleanly.

  1. Identify the service owning the pipe. Open PowerShell as admin and run:
    Get-Process | Where-Object { $_.ProcessName -like '*sql*' -or $_.ProcessName -like '*svchost*' }
    Or check Event Viewer under Windows Logs -> System for source Pipe or NamedPipe. Look for the process ID (PID).
  2. Kill the pipe handle. Use handle.exe from Sysinternals or this PowerShell snippet to find and close the pipe:
    # Find all named pipes
    [System.IO.Directory]::GetFiles('\\.\pipe\') | Where-Object { $_ -match 'sql\|wmi' }
    
    # Close a specific pipe (requires admin)
    $pipe = [System.IO.Directory]::GetFiles('\\.\pipe\') | Where-Object { $_ -match 'sql\|wmi' }
    [System.IO.File]::Open($pipe, 'Open', 'Read', 'None').Close()
    This is hacky but works. For SQL Server, just restart the service instead.
  3. Restart the service. In PowerShell:
    Restart-Service -Name MSSQLSERVER -Force   # SQL Server example
    Restart-Service -Name Winmgmt -Force       # WMI example
    Wait 10 seconds. Then try your connection again.
  4. Check TCP/IP vs Named Pipes. If you're using SQL Server, go to SQL Server Configuration Manager, disable Named Pipes under SQL Server Network Configuration -> Protocols for MSSQLSERVER. Force TCP/IP only. I've seen mixed-mode protocols cause this exact error.
  5. Reboot if it's stubborn. Yes, it's the classic answer — but after step 3, if the error returns within minutes, you've got a deeper issue (see below).

Still Failing? Check These Three Things

  1. Antivirus real-time scanning. Some AV suites (looking at you, McAfee and Symantec) scan named pipe endpoints and corrupt them. Add an exclusion for the pipe path, or temporarily disable real-time scanning for a test.
  2. SPN registration. For SQL Server with Kerberos, a missing or duplicate SPN for MSSQLSvc can cause pipe failures. Run setspn -L yourserver and check for duplicates. Fix with setspn -D.
  3. Resource limits. On Server 2016/2019, the default max pipe instances is 512. If you've got many concurrent connections, you might hit the pipe limit. Increase it via registry: HKLM\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters\MaxMpxCt (set to 2048). Reboot required.

Real Scenario I Fixed Last Month

Client running SQL Server 2019 on Windows Server 2019. Every morning at 8 AM, their ETL job would fail with 0xE6. Turns out the nightly backup script was restarting SQL Server Agent, which killed the pipe connections. Switched the ETL to use TCP/IP only — problem gone. Named pipes are fine for local connections, but they're fragile. If you can use TCP/IP, do it.

Bottom line: ERROR_BAD_PIPE means a broken conversation. Kill the pipe, restart the service, and if that doesn't stick, force TCP/IP or check your antivirus.

Was this solution helpful?