-
-
Notifications
You must be signed in to change notification settings - Fork 29
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: Header must provide a Content-Length property. #77
Comments
add Ubuntu version |
More information: this issue is only occurring when I use |
On WSL, I am seeing a similar error on the same Ubuntu, VSCode 1.73.0, Racket 8.6, current racket-langserver (?) and Magic Racket version (0.6.4). Code that produces the content-length error + crash for me is: #lang racket
(require plot/no-gui)
(local-require (only-in plot/no-gui [plot-file plot-file*])) The error itself (in the developer tools console), shown whenever the file is interacted with:
Based on microsoft/vscode#4869, it seems like this could have something to do with the language server writing to stdout without an appropriate header in some particular case (eg improper output associated with processing something in Can we confirm that this is a langserver issue and file the issue there? It would also be nice if magic-racket could handle the error gracefully instead of crashing. (jeapostrophe/racket-langserver#76 shows an example of the header and also points at a possible improper content length, but this seems less likely as a cause.) |
I looked into this a bit further by running the extension with a debugger. It seems like the langserver is responding with a message like
The error message appears to cause the header to be missed as I guessed. I don't know what is standard for a language server response, but this seems like incorrect behavior if it's causing an error at the |
(Subsequently, proper responses are also messed up because the top of the underlying message passing buffer has been filled with junk and can't be cleared. I'm assuming the language server isn't crashed after hitting the exception, it seems to keep sending responses that look valid for non-janky racket code.) More information: it looks like these exceptions can't be caught on Magic Racket's side due to the jsonrpc reader not implementing a proper error handler as microsoft/vscode-languageserver-node#870 reports, and a PR for that is waiting since Dec 2021 (microsoft/vscode-languageserver-node#871). So for now it's important to prevent the language server from mixing stderr into the response. |
In case anyone else needs a quick fix for this, I confirmed that running a modified language server with the offending |
Finally figured this out! To cause this error, you need to be using It turns out that I fixed this by modifying |
Added a link to this issue in the README, closing. Thanks @elmisback for the detailed investigation and the workaround! |
Environment
Error message
Additional context
Thank you for this extension.
I really like it, but am currently running into the following error.
Magic Racket only seems to work for new files.
When I reopen a .rkt file, Magic Racket stops working.
Steps to reproduce:
#lang racket 'test
When I try to use these features, nothing happens.
When I check output -> extension host, I see the error message listed above.
I am able to "fix" the issue by turning off the language server, closing VS Code, and restarting the language server; however this is not convenient.
Any help would be appreciated, thank you.
The text was updated successfully, but these errors were encountered: