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

ERROR initialize:initialize: failed to add schemas from catalog #585

Open
Spitfire1900 opened this issue Mar 25, 2024 · 9 comments
Open

Comments

@Spitfire1900
Copy link

Getting the following error in the Even Better TOML LSP output pane:

Even Better TOML: 0.19.2
VSCode: 1.87.2
Windows: 11 (build 22631)

 WARN initialize:initialize: failed to fetch catalog error=error sending request: JsValue(TypeError: fetch failed
TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:11576:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5))

Caused by:
    JsValue(TypeError: fetch failed
    TypeError: fetch failed
        at Object.fetch (node:internal/deps/undici/undici:11576:11)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)) self.root=file:///c%3A/Bitbucket/myproject
ERROR initialize:initialize: failed to add schemas from catalog error=error sending request: JsValue(TypeError: fetch failed
TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:11576:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)) self.root=file:///c%3A/Bitbucket/myproject
 WARN no notification handler registered method=$/setTrace
@JounQin
Copy link
Collaborator

JounQin commented Mar 26, 2024

That doesn't help anything.

Please provide a minimal but runnable online reproduction.

@Spitfire1900
Copy link
Author

Spitfire1900 commented Mar 26, 2024

Unfortunately, this is all the output that's available in the even better TOML output pane in VScode. I have also been unable to reproduce it on other workstations.

@JounQin
Copy link
Collaborator

JounQin commented Mar 27, 2024

Based on fetch failed, it could just be a request error.

@Spitfire1900
Copy link
Author

I am behind a corporate web proxy in this scope. I've worked with our IT Security department to allow-list the schema catalog, but I can't be certain that the web proxy is the issue when the fetched resource that failed isn't dumped to console.

@Licapule
Copy link

Licapule commented Aug 1, 2024

I have the same trouble for 3 days. I tried to reinstall the plugin, but it doesn't work. I even tried running it on Ubuntu WSL.
Here is all output in vscode output Even Better TOML LSP pane

 INFO registered request handler method="initialize"
 INFO registered request handler method="textDocument/foldingRange"
 INFO registered request handler method="textDocument/documentSymbol"
 INFO registered request handler method="textDocument/formatting"
 INFO registered request handler method="textDocument/completion"
 INFO registered request handler method="textDocument/hover"
 INFO registered request handler method="textDocument/documentLink"
 INFO registered request handler method="textDocument/semanticTokens/full"
 INFO registered request handler method="textDocument/prepareRename"
 INFO registered request handler method="textDocument/rename"
 INFO registered notification handler method="initialized"
 INFO registered notification handler method="textDocument/didOpen"
 INFO registered notification handler method="textDocument/didChange"
 INFO registered notification handler method="textDocument/didSave"
 INFO registered notification handler method="textDocument/didClose"
 INFO registered notification handler method="workspace/didChangeConfiguration"
 INFO registered notification handler method="workspace/didChangeWorkspaceFolders"
 INFO registered request handler method="taplo/convertToJson"
 INFO registered request handler method="taplo/convertToToml"
 INFO registered request handler method="taplo/listSchemas"
 INFO registered request handler method="taplo/associatedSchema"
 INFO registered notification handler method="taplo/associateSchema"
 WARN initialize:initialize: failed to fetch catalog error=error sending request: JsValue(TypeError: fetch failed
TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:12293:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5))

Caused by:
    JsValue(TypeError: fetch failed
    TypeError: fetch failed
        at Object.fetch (node:internal/deps/undici/undici:12293:11)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)) self.root=file:///c%3A/Users/lic/Documents/Projects/myproject
ERROR initialize:initialize: failed to add schemas from catalog error=error sending request: JsValue(TypeError: fetch failed
TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:12293:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)) self.root=file:///c%3A/Users/lic/Documents/Projects/myproject
 WARN update_configuration:initialize: failed to fetch catalog error=error sending request: JsValue(TypeError: fetch failed
TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:12293:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5))

Caused by:
    JsValue(TypeError: fetch failed
    TypeError: fetch failed
        at Object.fetch (node:internal/deps/undici/undici:12293:11)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)) self.root=root:///
ERROR update_configuration:initialize: failed to add schemas from catalog error=error sending request: JsValue(TypeError: fetch failed
TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:12293:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)) self.root=root:///
 WARN update_configuration:initialize: failed to fetch catalog error=error sending request: JsValue(TypeError: fetch failed
TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:12293:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5))

Caused by:
    JsValue(TypeError: fetch failed
    TypeError: fetch failed
        at Object.fetch (node:internal/deps/undici/undici:12293:11)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)) self.root=file:///c%3A/Users/lic/Documents/Projects/myproject
ERROR update_configuration:initialize: failed to add schemas from catalog error=error sending request: JsValue(TypeError: fetch failed
TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:12293:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)) self.root=file:///c%3A/Users/lic/Documents/Projects/myproject
 WARN update_configuration:initialize: failed to fetch catalog error=error sending request: JsValue(TypeError: fetch failed
TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:12293:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5))

Caused by:
    JsValue(TypeError: fetch failed
    TypeError: fetch failed
        at Object.fetch (node:internal/deps/undici/undici:12293:11)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)) self.root=file:///c%3A/Users/lic/Documents/Projects/myproject
ERROR update_configuration:initialize: failed to add schemas from catalog error=error sending request: JsValue(TypeError: fetch failed
TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:12293:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)) self.root=file:///c%3A/Users/lic/Documents/Projects/myproject

There's nothing output in Even Better TOML output pane.

When I modify the config of the plugin, a new warning appears:

 WARN no notification handler registered method=$/setTrace

I have no idea about this problem.

Windows 11, VSCode 1.91.1, Even Better TOML 0.19.2

@nilreml
Copy link

nilreml commented Aug 16, 2024

I'm experiencing the same issue behind a corporate proxy, so I dug in:

The root cause appears to be undici not respecting HTTP_PROXY/NO_PROXY etc. env vars, fixed here.

The fix was released with undici v6.14.0, which in turn made it into nodejs v22.

I reckon upgrading to nodejs v22 should fix the issue (though I'm ill-equipped to do so at this time).

@bersbersbers
Copy link

I am seeing the same thing. I suspect it is due to ZScaler being rolled out in our company - at least when I turn off ZScaler, this error goes away (and is replaced by another, hopefully unrelated one). But without knowing which URL fails, I have no way of knowing how to work with IT to get this unblocked. Again, I suspect it's one of the following, but those all work fine in the browser and using curl:

External fetches should really be logged, at least in error cases. The magic happens here: if anyone knows rust, please send a PR hacking in some debug output :)

let mut index = match self.fetch_external(index_url).await {
Ok(idx) => idx,
Err(error) => {
tracing::warn!(?error, "failed to fetch catalog");
if let Ok(s) = self.cache.load(index_url, true).await {
return Ok(serde_json::from_value((*s).clone())?);
}
return Err(error);
}
};

@Licapule
Copy link

Licapule commented Feb 4, 2025

It seems that this problem only happens in VSCode stable version. After switching between the two versions of VSCode several times, I have been using it very well in VSCode Insider for about 3 months.

@bersbersbers
Copy link

setx NODE_EXTRA_CA_CERTS Path\To\ZScaler-Root-CA.pem fixed the issue for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants