How to fix Error 1368 on Windows 11

Windows 11 Troubleshooting Guide: Error 1368 – Named Pipe Impersonation Failure

Why This Error Happens

Error 1368 occurs when an application attempts to impersonate the client of a named pipe before any data has actually been transmitted through that pipe. This happens because the Windows security subsystem requires at least one read operation (via ReadFile or a similar API call) to establish the client’s security context before the ImpersonateNamedPipeClient function can succeed. Essentially, the server-side process is calling the impersonation API too early in the communication sequence, causing the security token retrieval to fail.

Step-by-Step Resolution Guide

Step 1: Verify the Application’s Call Sequence

  • Confirm that the server application calls ReadFile, ReadFileEx, or TransactNamedPipe before attempting ImpersonateNamedPipeClient.
  • Check the application logs or source code (if available) to trace the order of API calls.
  • If you are the developer, insert a successful read operation immediately after the ConnectNamedPipe call and prior to any impersonation logic.

Step 2: Check for Third-Party Software Interference

  • Open Task Manager (Ctrl+Shift+Esc) and look for any third-party security or antivirus software that might be intercepting named pipe traffic.
  • Temporarily disable third-party antivirus/firewall software to see if the pipe communication completes successfully.
  • If the issue resolves, add an exception for the specific named pipe path (e.g., \\.\pipe\YourPipeName) in the security software configuration.

Step 3: Restart the Dependent Services

  • Open the Services app by pressing Win + R, typing services.msc, and pressing Enter.
  • Locate the service associated with the application throwing the error (e.g., a custom service or a Windows service like Remote Procedure Call (RPC)).
  • Right-click the service, select Restart, and monitor if the named pipe connection re-establishes correctly.
  • If restarting a single service doesn’t help, restart the entire machine to clear any stale pipe handles in memory.

Step 4: Update or Reinstall the Application

  • Navigate to Settings > Apps > Installed Apps and locate the software generating the error.
  • Check the vendor’s website for a patch that specifically addresses named pipe security context issues on Windows 11.
  • If no patch exists, uninstall and reinstall the application to reset any corrupted binaries or misconfigured pipe handlers.

Alternative or Verification Steps

  • Verify the Fix: Use Process Monitor (ProcMon) from Sysinternals to filter on the specific pipe name and confirm that a ReadFile operation appears in the log before the ImpersonateNamedPipeClient call succeeds.
  • Alternative Solution: If modifying the application code isn’t possible, configure the server thread to perform a zero-byte “peek” read (using PeekNamedPipe) to force the client context to populate before attempting impersonation.