Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Program execution reached an invalid state. The execution should have never reached this code.

Dataflow (connected to a MySQL data source) refresh fails with "Program execution reached an invalid state. The execution should have never reached this code." when there is a date type column in Expand Columns step.

This problem seems to be related to:
https://community.powerbi.com/t5/Desktop/Program-execution-reached-an-invalid-state/m-p/2510849
https://community.powerbi.com/t5/DAX-Commands-and-Tips/Program-execution-reached-an-invalid-state/m-...

After some testing I can confirm that it's about date type columns. But it happens not only on a Change Type step (what other users experienced). I have no Change Type steps in my queries that cause dataflow refresh to fail, but I have Merge and Expand Columns steps. And it fails with "Program execution reached an invalid state" error if in Expand Columns step there is a date column.


As a workaround I tried to change column type to Integer before merging a table that contains date column with the main table. And then after Expand Columns step I'm using Change Type to change Integer back to Date. It solves the problem discussed in this topic, but it ruins Query Folding and makes dataflow refresh slower and as a result one of my queries still fails to refresh but this time with "Fatal error encountered during data read". A smaller query now works well with no "Program execution reached an invalid state" error.

I'm not sure if it's a bug in Power BI / Power Query, data gateway or MySQL connector, but my dataflows worked well until we replaced the gateway machine and reinstalled data gateway and MySQL connector. Maybe software update just triggered the problem not directly related to this software. By the way, the most recent version (8.0.29) of MySQL NET connector has another bug and doesn't work with Power BI, we're using a previous version.

Status: Accepted
Comments
Anonymous
Not applicable

Hi @avatorl ,

 

We have reproduced your issue and have submitted to internal icm 305548995 , engineers are doing their best to fix this issue . please be patient and I will give you feedback here once there is any progress.

 

Best Regards,
Community Support Team _ Caitlyn

 

Anonymous
Not applicable

I have the same problem.

In our case  we conect to some tables of our MySQL and could not conect to others. we conet to 6 tables and not conect to the next table

The error is 

Error: Program execution reached an invalid state. The execution should have never reached this code. Request ID: d71f0e16-5f2d-14a3-07f6-57f238e2c62a Activity ID: 934b6a42-53f9-4707-b476-07e05976b733

Do you know when this problema is solved?

 

Thanks

 

Marcos Barbosa

avatorl
Impactful Individual

@Anonymous ,
I was told by Microsoft support that it's MySQL / MySQL connector problem, not Power BI problem. I assume it probably could be solved by upgrading MySQL server (my client uses one of the older versions), but the client solved this problem by going back to an older version of MySQL Connector on the gateway server.

Anonymous
Not applicable

I used the older version of connector of MySQL (version 8.0.28), but the problem is not the conection. I can connect. The problema is that some tables return error when i tried to update. We have 20 tables in this dataflow and only 3 had a problem. I solved this situation when i changed the type at columns. Some columns that were of type data gave error in the update. I changed to text. After that the update was ok.

avatorl
Impactful Individual

Yes, error happens during data refresh. Not in Power Query editor. And this is exactly what we fixed usig older version of the MySQL connector, but it was 8.0.23. Also we used older version of a gateway, but I think it's not related to this exact problem. Changing data type also works as a workaround but it ruins query folding and it will be a problem if you have bigger tables.