Occasional cranks ok but won’t start is almost always some type of intermittent fuel or spark problem. First step is to narrow which of those it is, spark or fuel. Ask your shop if they can somehow outfit your car so when it happens you have a clue to whether it is spark or fuel. Beyond that you option is either to just make a guess and start replacing parts, or park the car at the shop and they can drive it as their daily driver or to run errands and eventually it will fail while one of the shop techs is driving it.
If I had that problem on my Corolla I’d bring along a spark testing gadget. If it wouldn’t start and the spark was ok, then I’d know it was probably a fuel problem.
I have had this same issue for 14 years. It most usually happens whenever it’s above 95 degrees and I’ve made one or more short runs, while the A/C was on during those trips. Whenever I return to the car to get to my next destination, the car starts but as soon as I put into gear, it stalls. I can keep giving the car gas otherwise, just not put it into gear. The car got towed to the Mazda dealer probably 5 times, they couldn’t duplicate the issue. Note, car would start up fine upon arrival at the dealership. They told me it was the gas pump and fuel pump relay assembly (it’s one combined unit, they told me) Well, here’s the bad part. They will only warranty the service for 30 days so if it’s not super hot during the next 30 days and it doesn’t happen again then I have to pay for a new part again. Grrr One time they said they “discovered” that there was a new part which should take care of the issue finally, well, another year went by and it happened again, so out with that theory. They also suggested, maybe buy a new car? hahaha I did buy it new! So, one trick I learned was to pop the hood and wait about ten minutes. Believe it or not this has worked every time! Oddly, however, it happened last night at around 7 pm (before it was always a hot day issue). So, I popped the hood and waited ten minutes and it started right up fine. Other than this one issue, the car really performs well. I will try the Autozone code suggestion and think about getting a crank position sensor replaced and/or idle air control valve and/or checking to see it the identification part numbers are the same for the fuel pump and defroster relay. The fuel pump has probably been replaced three or four times already @ $700 per “repair”. I’m really tired that this mystery issue can’t be solved permanently.