I think we should delegate checking whether file exists to somewhere else outside of this function. This is intended to be a general utils function, where the file may not need to exist locally even if it is a `file:/`.

Yes, NPEs are bad error messages and I will add a guard them.