tsdoc icon indicating copy to clipboard operation
tsdoc copied to clipboard

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

Open muuvmuuv opened this issue 5 years ago • 4 comments
trafficstars

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

muuvmuuv avatar Aug 17 '20 13:08 muuvmuuv

@muuvmuuv Thanks for reporting this! Something might be wrong with the schema server. I'll ask around.

octogonz avatar Aug 18 '20 04:08 octogonz

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.

octogonz avatar Aug 18 '20 04:08 octogonz

@octogonz Has anyone followed up the administrator to resolve this issue. Heft config schemas are unable to load as well. .e.g Unable to load schema from 'https://developer.microsoft.com/json-schemas/heft/typescript.schema.json': Request vscode/content failed unexpectedly without providing any details.. I have to add the en-us portion to have them loaded correctly.

ghost avatar Sep 09 '21 22:09 ghost

@apostolisms investigated earlier this summer but was unable to find anybody who owns that server. (This problem affects other groups like SPFx and Teams, so I'm surprised someone else hasn't pursued it.)

My proposal was to relocate all the Rush Stack schemas to https://rushstack.io/json-schemas/ which we control. It's not ideal, but it's easy to implement. If nobody has objections to that plan, lemme know.

octogonz avatar Sep 10 '21 02:09 octogonz

Problems loading reference 'https://json.schemastore.org/package': Unable to load schema from 'https://json.schemastore.org/package': getaddrinfo EAI_AGAIN json.schemastore.org.

adamsemma avatar Jan 04 '23 19:01 adamsemma

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.

LGW22 avatar Feb 27 '23 16:02 LGW22

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.

This problem sounds unrelated to this issue.

octogonz avatar Feb 28 '23 03:02 octogonz

@DevArvindsa @iclanton @apostolisms FYI I just confirmed that the redirect is still happening for https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json

octogonz avatar Feb 28 '23 04:02 octogonz

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?

qionghe9 avatar Mar 08 '23 06:03 qionghe9

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.

joshxyzhimself avatar Mar 27 '23 09:03 joshxyzhimself

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.

JohnSmall avatar Apr 11 '23 06:04 JohnSmall

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)

brokenthorn avatar May 01 '23 14:05 brokenthorn

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

lanxizhu avatar May 04 '23 09:05 lanxizhu

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.

blakeNaccarato avatar May 05 '23 16:05 blakeNaccarato

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

SabitaOjha avatar May 10 '23 12:05 SabitaOjha

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

I'm getting the same error from a few days back.

ypkkhatri avatar May 13 '23 19:05 ypkkhatri

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,.

Ender-Wang avatar May 20 '23 09:05 Ender-Wang

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

Zamiell avatar May 25 '23 14:05 Zamiell

@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.

Ender-Wang avatar May 25 '23 14:05 Ender-Wang

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.

Same here.

Asiinoob avatar May 29 '23 06:05 Asiinoob

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.

KnifeFed avatar Jun 14 '23 21:06 KnifeFed

I'm closing this issue because the original problem (redirecting to en-us localized URLs) has been solved. If anyone is still having trouble, please open a new GitHub issue with repro steps. Thanks!

octogonz avatar Jun 14 '23 22:06 octogonz

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.

jayant0146 avatar Jul 16 '23 05:07 jayant0146

I just encountered the same issue. Switching to the pre-release version of the Python extension solved it for me... for now 😅

cebasfu93 avatar Jul 19 '23 13:07 cebasfu93