How to fix Error 8005 on Windows Server 2025 / Windows 11

Troubleshooting Guide: TDS RPC Protocol Stream Error (Error 8005)

Why This Error Happens

This error occurs when the TDS (Tabular Data Stream) packet sent from a client application to SQL Server 2025 contains a malformed Remote Procedure Call (RPC) request, typically due to an invalid or mismatched parameter name being passed to a stored procedure. This is commonly caused by outdated or corrupted client-side drivers (ODBC/OLE DB) that incorrectly format the parameter metadata, or by a mismatch between the parameter names defined in the application code and the actual stored procedure signature on the server. In some cases, network packet corruption or an incompatible connection pooling configuration can also scramble the parameter data before it reaches the SQL Server engine.

Step-by-Step Resolution Guide

Step 1: Verify Stored Procedure Parameter Names

  • Open SQL Server Management Studio (SSMS) and run sp_helptext 'YourStoredProcedureName' to inspect the exact parameter names and data types.
  • Cross-reference these names with the parameter collection in your application code (e.g., C# SqlCommand.Parameters.Add) to ensure there are no typos or case-sensitivity mismatches (e.g., @UserID vs @UserId).
  • Ensure no extra or missing parameters are being sent compared to what the procedure expects.

Step 2: Update Client Drivers and Connection Libraries

  • Navigate to the Microsoft Download Center and update the Microsoft OLE DB Driver for SQL Server or ODBC Driver to the latest version compatible with SQL Server 2025.
  • On Windows Server 2025, check C:\Windows\System32\msodbcsql18.dll (or relevant driver path) to confirm the version via file properties.
  • Restart the application pool (if using IIS) or the client service to ensure the new driver DLLs are loaded into memory.

Step 3: Clear Procedure Cache and Recompile

  • Execute DBCC FREEPROCCACHE in a query window to clear potentially corrupted execution plans that might be referencing old parameter signatures.
  • Force a recompile of the specific stored procedure using EXEC sp_recompile 'YourStoredProcedureName'.
  • Re-run the application query to see if the RPC stream is accepted correctly.

Step 4: Check for Network Packet Corruption

  • Open Event Viewer on Windows Server 2025 and check the System logs for any underlying TCP/IP or NIC driver errors occurring simultaneously with Error 8005.
  • If found, update the Network Interface Card (NIC) drivers via Device Manager or disable TCP Chimney Offload using PowerShell: Disable-NetAdapterChecksumOffload -Name "*".
  • Re-test the connection to rule out hardware-level packet corruption.

Alternative or Verification Steps

  • Verification: Run a SQL Server Profiler trace (or Extended Events session) filtered for RPC:Starting and RPC:Completed events to visually confirm the parameters are now being passed correctly without triggering Error 8005.
  • Alternative: If the error persists only in a specific application, bypass the ORM (Object-Relational Mapper) layer temporarily and execute the stored procedure directly via a raw SqlCommand to isolate whether the bug lies in the ORM’s parameter-mapping logic or the database schema itself.