I've had this problem, you need 2 things
1-toothbrush
2-throttle/intake cleaner(not carb)
You need to clean the throttle body.
The battery went dead, ECM can't find the proper throttle position,
You probably had symptoms like flickering lights, p/s cutting out, thought alt was bad. Do this and it will run like a top.
CEL might come on, you can clear with a cheap obd2 scanner, or it might go out on if own if you drive it til it meets criteria.
There is a YouTube video on this exact thing,
Type in clean throttle 5.3 L or something like that