code-server: Unable to write to Folder Settings because no resource is provided.
- 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?
Steps to reproduce
- install code-server 3.11
code-server --auth none- open in browser
- see error toast notification
Expected
No error
Actual
https://user-images.githubusercontent.com/3806031/127692356-5d22ace9-a1ae-45db-8aa1-256548c878ca.mov
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (11 by maintainers)
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.
@jsjoeio that’s some incredible detective work. Incredible 👏🏻
@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:
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
@caochuansong @djasonweiser @aryasenna @wjziv can one of you confirm that this fixes it?
Solution
And let me know if that fixes it?
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.tswhich has a private method calledtoErrorMessageand 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_CONFIGURATIONerror.Pulling that apart, it’s an
ifstatement with a single condition check consisting of two checks.configurationProperties[operation.key].scope === ConfigurationScope.RESOURCEandconfigurationProperties[operation.key].scope === ConfigurationScope.LANGUAGE_OVERRIDABLE.If either of those evaluate to
falsethen this check fails, causing the rejection with the error.Time to investigate
ConfigurationScope.RESOURCEandConfigurationScope.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 seeConfigurationScopeis an enum. Here’s what it tells us:So now the question is, where are these resource configuration set? I’m going to search fo
LANGUAGE_OVERRIDABLEsince 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.tsthere is a class which has a private method calledupdateSchemato set this property.Hmm…looking around, nothing specific stands out. Let’s move on to
RESOURCEHmm…still unsure where this could be happening. My guess is VS Code starts up and expects a
RESOURCEwhen registering the configuration. I know inlib/vscode/src/vs/server/server.tsthere is aconfigurationServicecreated. My hunch would be to look there.I think it makes sense run code-server locally with either the
debuggeror someconsole.logstatements near the error to continue troubleshooting.This is strange. I put a
console.logon L508 inconfigurationEditingServicebut 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.rejectso the service calls the
rejectmethod which returnsPromise.rejectwith a new message.at
ConfigurationEditingService.resolveAndValidateadding a console log here to see if we see it. (we do)
going to see if I can use the
debugger.nope,
debuggerdidn’t work.Okay following the stack trace, looks like we are here:
This means
operation.resouceis 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?nope, even with extension uninstalled, it still happens.
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.
*.ipynbjupyter.notebook.ipynbPreviously:
Wait a second…that made it go away? (I’m no longer seeing the error)
Yup, adding it back causes the error toast. I think that’s the culprit.
thanks @jsjoeio
Also chiming in to say that this happens to me as well.
So… This is not only limited to local OS being Mac OS or Chrome only, Windows is also affected.
Oh you were able to reproduce like that? Odd, it didn’t reproduce for me. This couldn’t somehow be related to the local OS being MacOS could it? Seems unlikely.