Theia: bug: error thrown when changing themes without a 'settings.json'

Created on 4 Aug 2020  路  6Comments  路  Source: eclipse-theia/theia

Bug Description:

There is an error thrown when changing themes without a settings.json present (no home .theia):

logger-protocol.ts:112 root ERROR Error: Unable to write file '/settings.json' (EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, open '/home/evinfug/.theia/settings.json')
    at new FileOperationError (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:3060:28)
    at FileService.push.../../packages/filesystem/lib/browser/file-service.js.FileService.asFileOperationError (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:1413:34)
    at FileService.push.../../packages/filesystem/lib/browser/file-service.js.FileService.rethrowAsFileOperationError (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:1410:20)
    at FileService.<anonymous> (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:1253:30)
    at step (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:518:23)
    at Object.throw (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:499:53)
    at rejected (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:491:65)
Caused by: Error: Request 'writeFile' failed
    at Proxy.<anonymous> (file:///home/evinfug/workspaces/theia/examples/electron/lib/bundle.js:137680:33)
    at RemoteFileSystemProvider.push.../../packages/filesystem/lib/common/remote-file-system-provider.js.RemoteFileSystemProvider.writeFile (file:///home/evinfug/workspaces/theia/examples/electron/lib/78.bundle.js:923:28)
    at DelegatingFileSystemProvider.push.../../packages/filesystem/lib/common/delegating-file-system-provider.js.DelegatingFileSystemProvider.writeFile (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:2765:34)
    at FileService.<anonymous> (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:2179:60)
    at step (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:518:23)
    at Object.next (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:499:53)
    at file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:493:71
    at new Promise (<anonymous>)
    at push.../../packages/filesystem/lib/browser/file-service.js.__awaiter (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:489:12)
    at FileService.push.../../packages/filesystem/lib/browser/file-service.js.FileService.doWriteUnbufferedQueued (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:2156:16)
Caused by: EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, open '/home/evinfug/.theia/settings.json'
    at new FileSystemProviderError (/home/evinfug/workspaces/theia/packages/filesystem/lib/common/files.js:230:28)
    at Object.createFileSystemProviderError (/home/evinfug/workspaces/theia/packages/filesystem/lib/common/files.js:239:25)
    at DiskFileSystemProvider.toFileSystemProviderError (/home/evinfug/workspaces/theia/packages/filesystem/lib/node/disk-file-system-provider.js:1168:24)
    at DiskFileSystemProvider.<anonymous> (/home/evinfug/workspaces/theia/packages/filesystem/lib/node/disk-file-system-provider.js:448:36)
    at step (/home/evinfug/workspaces/theia/packages/filesystem/lib/node/disk-file-system-provider.js:73:23)
    at Object.throw (/home/evinfug/workspaces/theia/packages/filesystem/lib/node/disk-file-system-provider.js:54:53)
    at rejected (/home/evinfug/workspaces/theia/packages/filesystem/lib/node/disk-file-system-provider.js:46:65)

For such a case, should the preference service create the settings.json if we programatically attempt to set a preference?

Steps to Reproduce:

  1. make sure that your home .theia folder does not exist (ex: rm -rf ~/.theia)
  2. start the application
  3. open devtools
  4. change theme using the command palette
  5. notice the thrown errors on the console
![theme](https://user-images.githubusercontent.com/40359487/89297389-bebcb080-d631-11ea-853f-823cb73c7b0b.gif)
bug filesystem preferences

All 6 comments

I'm wondering if its not a real-world use case that the ~/.theia folder is deleted and is just and issue with my workflow of clearing the home folder when testing/performing a cleanup.

I would expect that it writes a new file. It looks like a regression. I will have a look into it. So I delete my home folder and try to change theme?

I would expect that it writes a new file. It looks like a regression. I will have a look into it. So I delete my home folder and try to change theme?

Yes exactly :+1:

It only reproducible if I delete the entire user home directory (not only settings file). The issue is that nsfw watcher collapses and does not report that the file on the disk is deleted. I believe it should have been the same with the old fs API. Deleing user home when app is running is error prone for sure there are many data besides settings file.

Just to add, I verified in v1.4.0 and the error is not thrown under the same use-case.

Oh, new fs api stops creating parent directories at the root and for user-storage scheme everything belong to the root, so we have to add some parent directory like user-storage://user/settings.json, where user corresponds to .theia.

Was this page helpful?
0 / 5 - 0 ratings