“Internal connection fatal error” When Executing a Natively Compiled Stored Procedure in SQL Server 2019 (Known Bug)

If you’re getting the following error (or similar error) while trying to execute a natively compiled stored procedure in SQL Server 2019, read on.

Query failed: Internal connection fatal error.

I just got that error when running a natively compiled stored procedure in SQL Server 2019, but when I switched to SQL Server 2017 using the same (scripted) memory-optimized tables, natively compiled procedure, etc, it executed fine.

I then switched to a different client and ran the query again on SQL Server 2019 – no problem.

Then I found out that it’s a known bug in SQL Server 2019:

I’d like to confirm this was identified as a bug in the SQL Server 2019 and we have received confirmation on the fix made to address the same.

The upcoming SQL Server 2019 CU2 release will address this issue.
There will be no changes required in SqlClient and JDBC drivers.

So it looks like it will be addressed in the next release of SQL Server 2019.

In the meantime, try using mssql-cli if you’re getting the error in your client.