Turns over, but wouldn’t start, started 20 mins later

2004 Chevrolet Colorado Z71
~143k miles
Spark plugs replaced within the last 10-15k miles ago

Today I drove my truck for about 15 mins somewhere where it stayed off for about 35 mins while I was inside. When I got back in the truck, it wouldn’t start. The engine turned over, but wouldn’t actually start. I tried this several times for about 20 mins, after which it finally started up and I was able to drive home where I turned it off, let it sit for a minute and started it back up no problem again.

Anybody have any ideas what the cause could be?

Sometimes the anti-drainback valve in the fuel pump fails. Fuel and fuel pressure bleed off back into the tank, and there’s not enough fuel/fuel pressure at the engine when you try to start. Try the “key dance:” turn the key to Run (not all the way to Start) and back to Off. Do this a few times. Each time the fuel pump should run for a few seconds (you may hear it) and build up fuel and fuel pressure at the engine. Then turn the key all the way to Start. Does the engine turn over and start up quickly?

I’d also consider the crankshaft position sensor. They tend to get hot and quit, set no code, and allow the car to start when it cools off. Both age and miles are right for this.

If it happens again tomorrow, I’ll try the key dance. Normally it turns over and starts up quickly. Sometimes it may take a second. After I got back home, turned it off and restarted it, it started up quickly like normal.