From: Winnipeg, MB
The game code already has checks to avoid auto subs running out of fuel. These checks were tightened considerably in an early patch. The code will not send out a sub with insufficient fuel to (a) get to the location and (b) return to base and (c) have some spare fuel to account for patrol time and combat. Of course if its departing home port is lost after the sub TF has put to sea, then those calculations have been rendered null.
Either you have not patched the game or there are some other relevant player actioned facts which you have omitted to state.
I can confirm that, on occasion, computer-controlled subs will occasionally run their tanks dry while RTB'ing.
Installation has latest official patch and unofficial Beta 7 patch. Using Andy's Scenario 100.
In my case, it only occurs with the older, shortest-ranged Dutch K-class boats (stationed at either Chittagong or Trincomalee), or any USN Old S-Class boats at San Diego (the before-mentioned endurance treks from San Diego to Perth). In the case of the old Dutch boats, they'll head out on patrol but run dry roughly ten hexes before arrival on their return trip. They were on auto ops, and their assigned homeports are secure and stable, sufficiently stocked, and have surviving Dutch ASs present.
To date, none of the Gatos or T-Classes (Midway), or pre-fleet boat S's (Brisbane), or P's (Perth) have run into this issue. The long-legged Dutch O class are good as well, as are the two Brit subs. Just the oldest, shortest ranged boats are having this issue.
The workaround is simply to manually manage the problematic boats, which is what I've done. But on auto-ops the problem is occurring.
The algorithm probably doesn't take account of high speed fuel usage when a sub reacts. It has no way of knowing how much that will happen when it does its original calculation. The computer should be the one scanning the subs every turn and starting the low fuel ones back to base. But maybe the developers wanted to reward diligent players and make casual ones pay a penalty in aggravation.
FWIW, I ran a sub out of fuel when I accidently left it on full speed and it was far from a base. It took about 20 days for the sail on the periscope to get it back to a base with fuel and the system damage was around 50 IIRC. Not too bad. That was a US fleet boat - I don't think the IJ subs are quite as sturdy.
No matter how bad a situation is, you can always make it worse. - Chris Hadfield : An Astronaut's Guide To Life On Earth