Fix #4323

Add a try/except block around cache lookup since the cachedir might not be there