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
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.
Hi, I also encountered the same problem,I’ve added following string to user settings, and the error was gone:
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 insettings.json
restores proper autocomplete/hover in VSCode’ssettings.json
until next VSCode restart. But ajson
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 ownsettings.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 insettings.json
restores proper autocomplete/hover in VSCode’ssetitngs.json
until next VSCode restart. But ajson
key must be poked after every restart. Here’s a rundown:json.<...>
tree of settings keys are initially at their defaults, e.g. none of these keys are explicitly specified in any of yoursettings.json
(maybe unnecessary, but this is my starting state).Developer: Reload Window
). Navigate to your usersettings.json
. The following warning presents in the Problems pane: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 yoursettings.json
and save the file. (You could’ve also poked"json.validate.enable"
to be eithertrue
orfalse
I think, maybe?)settings.json
, completing settings names and such. It should work now.settings.json
again, and autocomplete/hover still works.settings.json
, until some modification to thejson.<...>
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 ajson.<...>
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.
I have the same error. Autocomplete/suggestions don’t work, which is how I noticed something was wrong:
Error text:
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.
That only works for me until VSCode is restarted.
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.
I have encountered the same problem, how did you solve it?