Test connection failed because of an error in initializing provider. The given key was not present in the dictionary.

SB 5 Reputation points

I am getting this error VS2022 and VS2026 when tried to create a connection from ssis project with connection manager. SQL server version is Microsoft SQL Server 2022 (RTM-GDR) (KB5073031) - 16.0.1165.1 (X64) Nov 24 2025 19:08:45.

It was working well with the previous version of SQL server. I have tried all options like Trust Server certificate, encryption false etc. Tried with Oledb driver for sql server 19, 18 etc

thanks

Suresh.

  1. Deepesh Dhake 165 Reputation points

    Could you paste the exact error text?


Sign in to comment

2 answers

  1. Deepesh Dhake 165 Reputation points

    This error is a client-side provider mismatch, not your SQL Server or your TLS settings. "The given key was not present in the dictionary" is the SSIS designer failing to load a provider, which is why changing Encrypt/TrustServerCertificate did nothing .

    You can try:

    Uninstall every "Microsoft OLE DB Driver for SQL Server" entry in Programs and Features (18 and 19), then install a single current MSOLEDBSQL 19, making sure you get both the x64 and x86 builds of the same version. The designer runs as x86, so the x86 build must be present and must match the x64 one.

    If this doesn't fix then if you can provide detailed error message then that will be great.

    1. SB 5 Reputation points

      When I search for it in Programs and Features I see only 19 listed there. I uninstalled and reinstalled and still getting the same error. How do I get a detailed error? It gives a popup message saying I originally posted. Is there any other way to get a detailed message? Appreciate you taking time to answer!

    2. Erland Sommarskog 134.7K Reputation points MVP Volunteer Moderator

      Can you post a screenshot?

      The error message sounds like an internal error in Visual Studio, because "dictionary" does not make much sense in the context of connecting. The root case may be due to some connectivity issue, but the real is masked by this error.

      By the way, your instance of SQL Server is running the RTM version of 2022 with only security patches. This means that you are missing many fixes and improvements. I would recommend that you download and install the of SQL 2022 which is CU25. However, it is unlikely that it will resolve the issue you are running into.

    3. Deepesh Dhake 165 Reputation points

      The popup itself sometimes has an expander - look for a small arrow, a "Details," "Advanced," or "Technical Information" toggle, or a "Copy" button on the dialog. If it's there, that copies the full KeyNotFoundException stack trace.

      If not, check the Visual Studio ActivityLog. Close VS, then start it with logging:

      devenv /log

      then reproduce the error, close VS, then open the log at:

      %APPDATA%\Microsoft\VisualStudio<version>\ActivityLog.xml

      Windows Event Viewer also often catches .NET exceptions from VS: Event Viewer then Windows Logs then Application, filter to the time you reproduced it, look for a .NET Runtime or Application Error entry referencing devenv.exe.

      Also useful, and faster to check than chasing the trace: open the connection manager and watch when the error fires.

      If it throws the moment you open the dialog or click the server dropdown, it's likely the server-enumeration step (SQL Browser / instance list), not the provider.

      If it throws only when you click Test Connection or OK, it's the provider/connection path.

    4. SB 5 Reputation points

      👁 error

      Thanks Erland

    5. SB 5 Reputation points

      I selected the image and uploaded and its showing only the text in the image!


    Sign in to comment
  2. AI answer

    The error "Test connection failed because of an error in initializing provider. The given key was not present in the dictionary" when testing an SSIS OLE DB connection is a known issue in SQL Server 2016 SSIS after certain CUs, and is fixed by installing specific cumulative updates.

    From the available information, the documented fix is:

    1. Install the cumulative update that contains the fix for this error.
      • For SQL Server 2016, the fix is in:
        • Cumulative Update 6 for SQL Server 2016 SP2, or
        • Cumulative Update 14 for SQL Server 2016 SP1.
    2. After applying the appropriate CU, retry the Preview/Test Connection in the CDC Source / OLE DB connection manager.

    The context does not provide a corresponding KB for SQL Server 2022, but the pattern is that this specific dictionary-key error in SSIS design-time components is resolved by applying the CU that contains the fix.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.
Sign in to answer

Your answer