tsdoc: VS Code says "unable to load schema" because it redirects to `en-US`

VS Code throws an JSON Schema error because https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json is redirecting to https://developer.microsoft.com/en-us/json-schemas/tsdoc/v0/tsdoc.schema.json. When changing the $schema to the redirected URL I get schema validation again but eslint now prints:

Error loading TSDoc config file:
Errors encountered for ./tsdoc.json:
  Unsupported JSON "$schema" value; expecting "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json"
eslinttsdoc/syntax

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 8
  • Comments: 24

Most upvoted comments

Weird. I closed the tab of the file causing this error, the warning disappeared. I re-opened the tab of the file, warning did not reappear.

I have the same error. Autocomplete/suggestions don’t work, which is how I noticed something was wrong: image

Error text:

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)

Hi, I also encountered the same problem,I’ve added following string to user settings, and the error was gone:

 "json.validate.enable": false

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) Fix: add this line in the beginning of your User/settings.json file: "json.schemaDownload.enable": true,.

someone know this problem?

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.

EDIT: If you came here from Google like me looking for a solution to VSCode settings.json autocomplete/hover breaking, note that it’s already being addressed over at https://github.com/microsoft/vscode/issues/177142. This issue topic is actually not the right place to discuss that issue, I found out after typing the essay below. It should be fixed in a hotfix or the next release.

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. See my repro below, collapsed under “details” because it’s actually off-topic to this issue we’re in right now.

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.

Getting the following error while opening angular project in vs code. error

I have the same error. Autocomplete/suggestions don’t work, which is how I noticed something was wrong: image

Error text:

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)

Kindly help me with this problem?

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.

Fix: add this line in the beginning of your User/settings.json file: "json.schemaDownload.enable": true,.

That only works for me until VSCode is restarted.

@Ender-Wang Thanks, that worked for me! Can you give more context? What does this configuration change do, and why is it necessary?

It seems the schema vscode trying to get is either not in the dir or the version doesn’t matter what vscode expect. And the line enables vscode to download the desired version.

Interestingly, this problem does NOT apply to other schema URLs from the same server. For example, this one does not redirect:

https://developer.microsoft.com/json-schemas/rush/rush.schema.json

And if you add en-us, it redirects back to the above URL:

https://developer.microsoft.com/en-us/json-schemas/rush/rush.schema.json

It seems that each folder must be individually configured, since the ones that work are older projects, and the ones that are broken are newer projects. We need to find the person who administers that web server, and get them to generalize the configuration to apply to all folders.

Strange, this problem started happening sometime in the last few weeks. When creating a devcontainer for Rails + Posgres then the container can’t access the outside world because it only has the localhost network interface setup. And I get this error from the devcontainer file Unable to load schema from 'https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json': getaddrinfo EAI_AGAIN raw.githubusercontent.com.

But starting a Node + Postgres devcontainer has no problem at all because it creates an extra network interface which does allow contact with the outside world.

someone know this problem?

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.

I have encountered the same problem, how did you solve it?