Ionic app sometimes show white screen after splash and sometimes it works on the same device

I have the following code in ionic app, when I run the code on real device it keeps showing me a white screen after the splash screen and show an error message in the chrome inspect

CoreFileProvider: Error getting device OS. (anonymous)

I do know what is the problem, it is not my code and it sometimes works and sometimes does this behaviour on the same device, I tried to build it on different machines and I do not know why this strange behavior happen

async init(): Promise<void> {
        if (this.initialized) {
            return;
        }

        await Platform.ready();

        if (CoreApp.isAndroid()) {
            this.basePath = File.externalApplicationStorageDirectory || this.basePath;
        } else if (CoreApp.isIOS()) {
            this.basePath = File.documentsDirectory || this.basePath;
        } else if (!this.isAvailable() || this.basePath === '') {
            this.logger.error('Error getting device OS.');

            return Promise.reject(new CoreError('Error getting device OS to initialize file system.'));
        }

        this.initialized = true;
        this.logger.debug('FS initialized: ' + this.basePath);
    }