Skip to content
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

Problems loading settings schemas #177142

Closed
ddoggdiggitty opened this issue Mar 14, 2023 · 32 comments · Fixed by #186495 or #188053
Closed

Problems loading settings schemas #177142

ddoggdiggitty opened this issue Mar 14, 2023 · 32 comments · Fixed by #186495 or #188053
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders json JSON support issues verified Verification succeeded
Milestone

Comments

@ddoggdiggitty
Copy link

Type: Bug

I got the following error randomly while changing workspace settings. I used the extension bisect feature to see if it was an extension, but nothing was identified on the very first pass. The issue continued to persist, until Visual Studio Code was reloaded.

Here's the message that appeared in the problem pane:

Problems loading reference 'vscode://schemas/settings/workspace': Unable to load schema from 'vscode://schemas/settings/workspace': cannot open vscode://schemas/settings/workspace. Detail: Unable to resolve text model content for resource vscode://schemas/settings/workspace.

I found a similar issue regarding multi-root workspaces on github: #124491 (comment)
My workspace has multiple folders. I only edited the workspace settings and I never touched the folder settings for the workspace. I did made some recent adjustments by installing/uninstalling extensions, switching profiles, and editing workspace settings.

VS Code version: Code - Insiders 1.77.0-insider (bbe8e87, 2023-03-14T05:23:49.668Z)
OS version: Windows_NT x64 10.0.23403
Modes:
Sandboxed: Yes

System Info
Item Value
CPUs 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz (8 x 2803)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) undefined
Memory (System) 15.71GB (2.81GB free)
Process Argv --crash-reporter-id f283d74a-2be7-4cd0-86fd-41b52e41f42d
Screen Reader no
VM 0%
Extensions (11)
Extension Author (truncated) Version
Ionide-fsharp Ion 7.5.1
csharp ms- 1.25.4
dotnet-interactive-vscode ms- 1.0.4164011
vscode-dotnet-pack ms- 1.0.12
python ms- 2023.4.1
vscode-pylance ms- 2023.3.20
jupyter ms- 2023.3.1000752049
jupyter-keymap ms- 1.1.0
jupyter-renderers ms- 1.0.15
vscode-jupyter-cell-tags ms- 0.1.6
vscode-jupyter-slideshow ms- 0.1.5
A/B Experiments
vsliv695:30137379
vsins829:30139715
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256198
vslsvsres303:30308271
pythonvspyl392:30422396
pythontb:30258533
pythonptprofiler:30281269
vshan820:30294714
pythondataviewer:30285072
vscod805:30301674
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30404738
cppdebug:30492333
vsclangdf:30492506
c4g48928:30535728
dsvsc012:30540252
pynewext54:30618038
pylantcb52:30590116
pyindex848:30611229
nodejswelcome1:30587009
pyind779:30611226
pythonsymbol12:30651887
6233i204:30659907
vscodeenable:30660116
pythonb192:30661256
funwalk2cf:30682975
pythonms35:30671666
0bg3d529:30680467
57b77579:30677314

@aeschli
Copy link
Contributor

aeschli commented May 3, 2023

@sandy081 This is probably caused by delaying the registration of the vscode://schemas/settings/workspace schema (and others)
It would be better to register the schema immediately but empty, and to set it later again with content.

@aeschli aeschli assigned sandy081 and unassigned aeschli May 3, 2023
@aeschli aeschli changed the title Random error appears for the workspace file Problems loading settings schemas May 3, 2023
@Igorgro
Copy link

Igorgro commented May 4, 2023

Can this be at least workarounded somehow? It's very irritating - I cant edit any workspace settings

@blakeNaccarato
Copy link

blakeNaccarato commented May 5, 2023

I'm sure a hotfix will release the fix to all of us soon, but here's a workaround for now: I found that poking any json.<...> settings key in settings.json restores proper autocomplete/hover in VSCode's settings.json until next VSCode restart. But a json key must be poked after every restart. For example, put "json.schemaDownload.enable": true, at the top of your settings.json and save the file. You will have to toggle and save this key every time you start VSCode. A detailed set of steps for doing this can be inspected at the end of this comment.

If you use the VSCode extension Settings Cycler, you can set up a hotfix keybind (like Ctrl+Alt+Shift+Q in this case), and press the keybind twice every time you restart VSCode. Or, just never restart VSCode until the patch drops! 😅

settings.json

  "settings.cycle": [
    {
      "id": "copilot",
      "values": [
        {
          "github.copilot.inlineSuggest.enable": false
        },
        {
          "github.copilot.inlineSuggest.enable": true
        }
      ]
    },
    //! https://github.com/microsoft/vscode/issues/177142
    {
      "id": "hotfix",
      "values": [
        {
          "json.schemaDownload.enable": true
        },
        {
          "json.schemaDownload.enable": false
        }
      ]
    }
  ],
  //! https://github.com/microsoft/vscode/issues/177142
  "json.schemaDownload.enable": true,

keybindings.json

  //! https://github.com/microsoft/vscode/issues/177142
  {
    "key": "ctrl+shift+alt+q",
    "command": "settings.cycle.hotfix"
  },
details

I can confirm that setting "json.validate.enable": false allows hover hints and completion to function again, e.g. in VSCode's own settings.json modification. However, this workaround throws out all JSON linting and reporting in the "Problems" pane, so it's sort of the nuclear option. This issue just cropped up for me in the past few days, so it may be a regression associated with the latest release?

After further investigation, I find that poking any json.<...> settings key in settings.json restores proper autocomplete/hover in VSCode's setitngs.json until next VSCode restart. But a json key must be poked after every restart. Here's a rundown:

  1. Ensure all json.<...> tree of settings keys are initially at their defaults, e.g. none of these keys are explicitly specified in any of your settings.json (maybe unnecessary, but this is my starting state).
  2. Restart VSCode (e.g. with Developer: Reload Window). Navigate to your user settings.json. The following warning presents in the Problems pane:
Unable to load schema from 'vscode://schemas/settings/user': cannot open vscode://schemas/settings/user. Detail: Unable to resolve text model content for resource vscode://schemas/settings/user.
  1. Make a trivial setting modification in the json tree of settings keys, even if that modification is a no-op, like explicitly specifying a default as its default value. For example, put "json.schemaDownload.enable": true, at the top of your settings.json and save the file. (You could've also poked "json.validate.enable" to be either true or false I think, maybe?)
  2. Check whether autocomplete/hover works properly in settings.json, completing settings names and such. It should work now.
  3. You can even remove the edit you made in step (4), save settings.json again, and autocomplete/hover still works.
  4. Restart VSCode.
  5. Now autocomplete/hover is broken again in settings.json, until some modification to the json.<...> tree of settings keys is made again, like in step 4. For example, commenting out "json.validate.enable": true if it's there, and saving, restores autocomplete/hover.

So this issue may have to do with unstable startup behavior of JSON schema handling, perhaps isolated to VSCode's own settings.json or perhaps all JSON schemas more broadly, and this unstable state can be temporarily fixed by poking a json.<...> settings key, but the unstable behavior returns on the next program start. At least in my case.

@sandy081 sandy081 added bug Issue identified by VS Code Team member as probable bug config VS Code configuration, set up issues labels May 12, 2023
@sandy081 sandy081 added this to the May 2023 milestone May 12, 2023
@sandy081 sandy081 modified the milestones: May 2023, June 2023 May 30, 2023
@k98kurz
Copy link

k98kurz commented Jun 10, 2023

I have encountered a similar error: Unable to load schema from 'vscode://schemas/settings/user': cannot open vscode://schemas/settings/user. Detail: Unable to resolve text model content for resource vscode://schemas/settings/user.(768)

So nothing I do in my settings.json file has any effect. Not only that, but when I type "settings.json" into the Settings search bar, the only thing that comes up is a reference to a defaultSettings.json file under Terminal > Integrated: Commands To Skip Shell.

@thdoan
Copy link

thdoan commented Jun 13, 2023

In my case I think I found the culprit:

...
    "[svelte]": {
        "editor.defaultFormatter": "svelte.svelte-vscode"
    },
...

The property above gives a "Value is not accepted" error even though it's a valid value that works when the Svelte plugin is enabled (it's currently disabled). As soon as I delete this property, the "Unable to load schema" error goes away. Weird.

Update: I spoke too soon -- after reloading VS Code, the "Unable to load schema" error is back 😓

@k98kurz
Copy link

k98kurz commented Jun 14, 2023

I have encountered a similar error: Unable to load schema from 'vscode://schemas/settings/user': cannot open vscode://schemas/settings/user. Detail: Unable to resolve text model content for resource vscode://schemas/settings/user.(768)

A few days/restarts later, and the error is gone. Looks like a Heisenbug. 🤷‍♀️

@andrew-goldie
Copy link

For me the problem message appears in a typescript node project when I have package.json open. Close this file and the problem message goes away. (The package.json file contains no known issues). While others report either user or workspace settings reference loading problems, for me it is configurationDefaults:

Problems loading reference 'vscode://schemas/settings/configurationDefaults': Unable to load schema from 'vscode://schemas/settings/configurationDefaults': cannot open vscode://schemas/settings/configurationDefaults. Detail: Unable to resolve text model content for resource vscode://schemas/settings/configurationDefaults.

@getaaron
Copy link

@sandy081 @aeschli is there any update on it? it's very frustrating and I don't see a reliable workaround

@sandy081 sandy081 modified the milestones: June 2023, July 2023 Jun 26, 2023
@Denver80211
Copy link

Denver80211 commented Jul 12, 2023

Currently experiencing this issue. I can overcome it temporarily following a suggestion elsewhere where I add or remove
"json.schemaDownload.enable": true
to my settings.json file.
I keep adjusting the file to see if there is something in there ausing the issue. Even old, known settings are causing the error to kick in regularly. I put a single setting in there and the error comes up unless it's empty

Version: 1.80.0 (user setup)
Commit: 660393d
Date: 2023-07-04T15:06:02.407Z (1 wk ago)
Electron: 22.3.14
ElectronBuildId: 21893604
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Windows_NT x64 10.0.19045

@c0m3tx
Copy link
Contributor

c0m3tx commented Jul 13, 2023

Currently experiencing the issue on my linux machine. On my Windows machine (with the same configuration file, since it's synchronized) it works fine on stable, but not on insiders.

Can confirm that toggling json.schemaDownload.enable as a workaround works until restart.

Linux version:
Version: 1.80.0
Commit: 660393d
Date: 2023-07-04T13:39:48.236Z (1 wk ago)
Browser: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Code/1.80.0 Chrome/108.0.5359.215 Electron/22.3.14 Safari/537.36

Windows version (stable):
Version: 1.80.0
Commit: 660393d
Date: 2023-07-04T15:06:02.407Z (1 wk ago)
Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Code/1.80.0 Chrome/108.0.5359.215 Electron/22.3.14 Safari/537.36

Windows version (insiders):
Version: 1.81.0-insider
Commit: 2f1013a
Date: 2023-07-13T05:33:32.822Z (2 hrs ago)
Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Code-Insiders/1.81.0-insider Chrome/108.0.5359.215 Electron/22.3.14 Safari/537.36

@sandy081
Copy link
Member

Reopening this because it can be still reproduced.

@sandy081 sandy081 added json JSON support issues and removed config VS Code configuration, set up issues labels Jul 17, 2023
sandy081 added a commit that referenced this issue Jul 17, 2023
sandy081 added a commit that referenced this issue Jul 17, 2023
@VSCodeTriageBot VSCodeTriageBot added unreleased Patch has not yet been released in VS Code Insiders insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Jul 17, 2023
@AustynT
Copy link

AustynT commented Jul 20, 2023

I am getting this error and I can't figure out how to fix it.

Unable to load schema from 'vscode://schemas/settings/folder': cannot open vscode://schemas/settings/folder. Detail: Unable to resolve text model content for resource vscode://schemas/settings/folder.(768)

@sandy081
Copy link
Member

Please try our insiders and see if you are still seeing it

@garrettw
Copy link

Currently seeing this while in a devcontainer.json file on GitHub Codespaces, in the following form:

Problems loading reference 'vscode://schemas/settings/machine': Unable to load schema from 'vscode://schemas/settings/machine': cannot open vscode://schemas/settings/machine. Detail: Unable to resolve text model content for resource vscode://schemas/settings/machine.

@sandy081
Copy link
Member

@garrettw Can you please try insiders and see if you are still seeing this?

@brokenthorn
Copy link

I still saw this issue when opening settings.json on:

Version: 1.80.1 (user setup)
Commit: 74f6148
Date: 2023-07-12T17:22:07.651Z
Electron: 22.3.14
ElectronBuildId: 21893604
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Windows_NT x64 10.0.22621

@garrettw
Copy link

@sandy081 As I mentioned, this was in GitHub Codespaces. I can't change the version of VS Code they serve to the browser.

@sandy081
Copy link
Member

There should be an action Switch to Insiders... in the settings gear icon in the bottom left corner, do you have that?

@ulugbekna ulugbekna added the verified Verification succeeded label Jul 27, 2023
@yaneproger
Copy link

uninstalled installed all extensions, including-
C# v2.0.328, autopep8 -for python,
ctrl+shift+p - selected -format this document with - seleceted C#-
All things worked again.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders json JSON support issues verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.