write_entry(): fix misuses of `path` in error messages