Skip to content

Unable to write to Folder Settings because no resource is provided. #3873

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
caochuansong opened this issue Jul 29, 2021 · 17 comments
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@caochuansong
Copy link

caochuansong commented Jul 29, 2021

  • Web Browser: chrome
  • Local OS: macos
  • Remote OS: centos
  • Remote Architecture:
  • code-server --version: 3.11

every time I refresh web page, I got this error:
Unable to write to Folder Settings because no resource is provided.

how to config it?

Screen Shot 2021-07-29 at 20 15 36

Steps to reproduce

  1. install code-server 3.11
  2. code-server --auth none
  3. open in browser
  4. see error toast notification

Expected

No error

Actual

Screen.Recording.2021-07-30.at.10.49.08.AM.mov
@jsjoeio jsjoeio added the needs-investigation This issue needs to be further investigated label Jul 29, 2021
@jsjoeio
Copy link
Contributor

jsjoeio commented Jul 29, 2021

Thanks for filing! I think we need to investigate this.

I noticed this happening in 3.11 - I wonder if something changed in VS Code upstream that we forgot to change. Any ideas @oxy @code-asher ?

@code-asher
Copy link
Member

code-asher commented Jul 30, 2021 via email

@jsjoeio
Copy link
Contributor

jsjoeio commented Jul 30, 2021

Updated description with repro steps!

@code-asher
Copy link
Member

code-asher commented Aug 2, 2021 via email

@jsjoeio
Copy link
Contributor

jsjoeio commented Aug 2, 2021

Hmm...could question. Here is the stack trace:

ERR Unable to write to Folder Settings because no resource is provided.: Error: Unable to write to Folder Settings because no resource is provided.
    at b.reject (http://localhost:8080/static/4e8cd09ef0412dfc7b148b7639a692e20e4fd6dd/usr/local/Cellar/code-server/3.11.0/libexec/lib/vscode/out/vs/workbench/workbench.web.api.js:2403:15316)
    at b.resolveAndValidate (http://localhost:8080/static/4e8cd09ef0412dfc7b148b7639a692e20e4fd6dd/usr/local/Cellar/code-server/3.11.0/libexec/lib/vscode/out/vs/workbench/workbench.web.api.js:2403:19500)
    at b.doWriteConfiguration (http://localhost:8080/static/4e8cd09ef0412dfc7b148b7639a692e20e4fd6dd/usr/local/Cellar/code-server/3.11.0/libexec/lib/vscode/out/vs/workbench/workbench.web.api.js:2403:12506)
    at Object.factory (http://localhost:8080/static/4e8cd09ef0412dfc7b148b7639a692e20e4fd6dd/usr/local/Cellar/code-server/3.11.0/libexec/lib/vscode/out/vs/workbench/workbench.web.api.js:2403:12282)
    at y.consume (http://localhost:8080/static/4e8cd09ef0412dfc7b148b7639a692e20e4fd6dd/usr/local/Cellar/code-server/3.11.0/libexec/lib/vscode/out/vs/workbench/workbench.web.api.js:68:15342)
    at http://localhost:8080/static/4e8cd09ef0412dfc7b148b7639a692e20e4fd6dd/usr/local/Cellar/code-server/3.11.0/libexec/lib/vscode/out/vs/workbench/workbench.web.api.js:68:15157
    at new Promise (<anonymous>)
    at y.queue (http://localhost:8080/static/4e8cd09ef0412dfc7b148b7639a692e20e4fd6dd/usr/local/Cellar/code-server/3.11.0/libexec/lib/vscode/out/vs/workbench/workbench.web.api.js:68:15081)
    at b.writeConfiguration (http://localhost:8080/static/4e8cd09ef0412dfc7b148b7639a692e20e4fd6dd/usr/local/Cellar/code-server/3.11.0/libexec/lib/vscode/out/vs/workbench/workbench.web.api.js:2403:12267)
    at y.writeConfigurationValue (http://localhost:8080/static/4e8cd09ef0412dfc7b148b7639a692e20e4fd6dd/usr/local/Cellar/code-server/3.11.0/libexec/lib/vscode/out/vs/workbench/workbench.web.api.js:2403:41475)

Maybe something changed with how the configuration is stored locally on macOS?

@wjziv
Copy link

wjziv commented Aug 3, 2021

Chiming in to say I have the same experience every time I refresh the IDE window on a different OS.
Code-Server is hosted in a container by Unraid.

  • Web Browser: chrome
  • Local OS: chromeOS
  • Remote OS: Unraid
  • Remote Architecture: docker
  • code-server --version: 3.11

@aryasenna
Copy link

So.. This is not only limited to local OS being Mac OS or Chrome only, Windows is also affected.

  • Web Browser: Edge
  • Local OS: Windows 10
  • Remote OS: ubuntu 20.04
  • Remote Architecture: AMD64
  • code-server --version: 3.11

@jason-weiser
Copy link

Also chiming in to say that this happens to me as well.

  • Web Browser: Firefox 90.0.2
  • Local OS: MacOS 11.4
  • Remote OS: Ubuntu 20.04.2
  • Remote Architecture: used the install script?
  • Code-server version: 3.11.1

@jsjoeio jsjoeio added bug Something isn't working and removed needs-investigation This issue needs to be further investigated labels Aug 10, 2021
@jsjoeio jsjoeio added this to the 3.12.0 milestone Aug 10, 2021
@jsjoeio
Copy link
Contributor

jsjoeio commented Aug 10, 2021

Thanks all for the notes! I've added this to the next upcoming milestone so we'll work on it soon.

@caochuansong
Copy link
Author

thanks @jsjoeio

@jsjoeio
Copy link
Contributor

jsjoeio commented Sep 2, 2021

I'm starting to work on this and taking notes here. I'll update this message as I go so I'm not spamming the issue with new comments each update.

Notes

searching for "Unable to write to Folder Settings because no resource is provided" reveals lib/vscode/src/vs/workbench/services/configuration/common/configurationEditingService.ts which has a private method called toErrorMessage and a switch statement to handle each error case.

It looks like this is the key block where VS Code rejects and with this ConfigurationEditingErrorCode.ERROR_INVALID_FOLDER_CONFIGURATION error.

if (!(configurationProperties[operation.key].scope === ConfigurationScope.RESOURCE || configurationProperties[operation.key].scope === ConfigurationScope.LANGUAGE_OVERRIDABLE)) {
	return this.reject(ConfigurationEditingErrorCode.ERROR_INVALID_FOLDER_CONFIGURATION, target, operation);
}

Pulling that apart, it's an if statement with a single condition check consisting of two checks.
configurationProperties[operation.key].scope === ConfigurationScope.RESOURCE and configurationProperties[operation.key].scope === ConfigurationScope.LANGUAGE_OVERRIDABLE.

If either of those evaluate to false then this check fails, causing the rejection with the error.

Time to investigate ConfigurationScope.RESOURCE and ConfigurationScope.LANGUAGE_OVERRIDABLE.

Both belong to the same object: ConfigurationScope.

This value is imported into the file from vs/platform/configuration/common/configurationRegistry.

Looking at lib/vscode/src/vs/platform/configuration/common/configurationRegistry.ts, we see ConfigurationScope is an enum. Here's what it tells us:

/**
* Resource specific configuration, which can be configured in the user, workspace or folder settings.
*/
RESOURCE,
/**
* Resource specific configuration that can be configured in language specific settings
*/
LANGUAGE_OVERRIDABLE,

So now the question is, where are these resource configuration set? I'm going to search fo LANGUAGE_OVERRIDABLE since I imagine that is less common of a search term and will be easier to find.

It appears in lib/vscode/src/vs/platform/configuration/common/configurationRegistry.ts there is a class which has a private method called updateSchema to set this property.

Hmm...looking around, nothing specific stands out. Let's move on to RESOURCE

Hmm...still unsure where this could be happening. My guess is VS Code starts up and expects a RESOURCE when registering the configuration. I know in lib/vscode/src/vs/server/server.ts there is a configurationService created. My hunch would be to look there.

I think it makes sense run code-server locally with either the debugger or some console.log statements near the error to continue troubleshooting.

This is strange. I put a console.log on L508 in configurationEditingService but I'm not seeing it logged to the browser or the server 🤔 I think the error is happening elsewhere.

Let's follow the stack trace up:

at ConfigurationEditingService.reject

so the service calls the reject method which returns Promise.reject with a new message.

at ConfigurationEditingService.resolveAndValidate

adding a console log here to see if we see it. (we do)

going to see if I can use the debugger.

nope, debugger didn't work.

Okay following the stack trace, looks like we are here:

if (!operation.resource) {
			return this.reject(ConfigurationEditingErrorCode.ERROR_INVALID_FOLDER_TARGET, target, operation);
		}

This means operation.resouce is the culprit 🤔

After logging it, it looks like it's related to "jupyter.notebook.ipynb". I wonder if this error has to do with the Jupyter extension?

  • see if error appears with extension uninstalled

image

nope, even with extension uninstalled, it still happens.

image

next step will be to continue up the stack trace until we get to the root of the error.

I feel like I'm hitting a dead-end. Not sure but I found this in the Settings. I wonder if I remove if it will go away.

image

*.ipynb jupyter.notebook.ipynb

Previously:

    "workbench.editorAssociations": [

      {
        "viewType": "jupyter.notebook.ipynb",
        "filenamePattern": "*.ipynb"
      }
    ],

Wait a second...that made it go away? (I'm no longer seeing the error)

- "workbench.editorAssociations": [
-    {
-       "viewType": "jupyter.notebook.ipynb",
-       "filenamePattern": "*.ipynb"
-     }
- ],
+ "workbench.editorAssociations": {
+    "*.ipynb": "jupyter.notebook.ipynb"
+ },

Yup, adding it back causes the error toast. I think that's the culprit.

@jsjoeio
Copy link
Contributor

jsjoeio commented Sep 2, 2021

@caochuansong @djasonweiser @aryasenna @wjziv can one of you confirm that this fixes it?

Solution

  1. Open Command Palette
  2. Open "Preferences: Open Settings (JSON)
  3. Look for "workbench.editorAssociations"
  4. Change it to this:
"workbench.editorAssociations": {
    "*.ipynb": "jupyter.notebook.ipynb"
},

And let me know if that fixes it?

@wjziv
Copy link

wjziv commented Sep 3, 2021

@jsjoeio
This appears to resolve the notification! I haven't seen it come back in existing directories. 🎉

I noticed at the same time as I the "Unable to write..." notification, when I navigated to subdirectories which did not exist, behavior changed from: "automatically create the subdirectory" to the familiar message "Unable to write to folder settings..."

Now I get the following response:

Unable to open 'new_subdir': Unable to read file 'vscode-remote://code.domain.com/config/workspace/dir/new_subdir' (Error: Unable to resolve non-existing file 'vscode-remote://code.domain.com/config/workspace/dir/new_subdir').

And it asks if I'd like to create the directory.

Sounds like a much better behavior, IMO!


However, there still exists a semi-related error on my end where Jupyter Notebooks aren't rendering... See #3874

@GirlBossRush
Copy link
Contributor

@jsjoeio that's some incredible detective work. Incredible 👏🏻

@jsjoeio
Copy link
Contributor

jsjoeio commented Sep 3, 2021

This appears to resolve the notification! I haven't seen it come back in existing directories. 🎉

Hooray! Thank you for confirming!

Unable to open 'new_subdir': Unable to read file 'vscode-remote://code.domain.com/config/workspace/dir/new_subdir' (Error: Unable to resolve non-existing file 'vscode-remote://code.domain.com/config/workspace/dir/new_subdir').

Weird...Well if you can easily reproduce, will you open an issue and I'll take a look?

However, there still exists a semi-related error on my end where Jupyter Notebooks aren't rendering... See #3874

Yeah, that's next on my list!

Going to close this for now!

@jsjoeio jsjoeio closed this as completed Sep 3, 2021
@rebelliousconformist
Copy link

Reopening this isssue.
Unable to open 'selfpractice': Unable to resolve resource vscode-remote://wsl%2Bubuntu-20.04/home/bapatnext/nac_dev/selfpractice.

Unable to write to Folder Settings because no resource is provided.

getting the same problems again

vscode server is VS Code Server for x64 (7db1a2b88f7557e0a43fec75b6ba7e50b3e9f77e)

vscode version is

1.63.0 7db1a2b88f7557e0a43fec75b6ba7e50b3e9f77e x64

@jsjoeio
Copy link
Contributor

jsjoeio commented Dec 15, 2021

@rebelliousconformist can you please open a new bug report with repro steps? Thank you!

@coder coder locked as resolved and limited conversation to collaborators Dec 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants