The workbench failed to connect to the server (Error: WebSocket close with status code 1006)
See original GitHub issueOS/Web Information
- Web Browser: Chromium (brave), although I also tested with Firefox and Edge and got the same result.
- Local OS: Windows 11
- Remote OS: Ubuntu
- Remote Architecture: x86-64
code-server --version: 3.12.0
Steps to Reproduce
- Ran code-server (i also tried using --proxy-domain <my domain> to see if I got any different results.) I used nginx to reverse proxy to my domain, I also use Cloudflare.
- When I open the domain on my browser, I get
The workbench failed to connect to the server (Error: WebSocket close with status code 1006)
Expected
The server would work normally.
Actual
See error above.
Logs
Logs look normal for the remote server, however browser gives error:
[vscode] failed to initialize VS Code vscode.browserified.js:726:13
[4]< <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:726
o <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:1
r <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:1
<anonymous> <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:1
(I replaced my domain with <domain> for privacy reasons.)
Error: [vscode] Could not set body background to theme background color. Could not find colorThemeData in localStorage.
setBodyBackgroundToThemeBackgroundColor <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:668
main <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:719
[4]< <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:723
o <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:1
r <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:1
<anonymous> <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:1
vscode.browserified.js:727:13
[4]< <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:727
o <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:1
r <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:1
<anonymous> <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:1
Screenshot

Notes
This issue can be reproduced in VS Code: No
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:17 (2 by maintainers)
Top Results From Across the Web
The workbench failed to connect to the server (Error ... - GitHub
The workbench failed to connect to the server (Error: WebSocket close with status code 1006) #4443. Closed.
Read more >Vscode cannot connect to remote Linux (_WebSocket close ...
This worked for me and when I went back into the Ubuntu shell and ran code . it updated the VS Code Server....
Read more >Websocket error 1006 with VSCode - Traefik v2
Hi all,. I'm trying to set up VSCode behind my traefikv2 container. Unfortunately I get a WebSocket 1006 error every time.
Read more >What Is Meant By Channels Error 1006? - Pusher
When a WebSocket connection is closed without a "close frame", the pusher-js library emits an error with code 1006. Usually this is caused...
Read more >Error 1006 abnormal close websocket? - Arduino Forum
Error 1006 means there's a low-level issue with websocket itself, or rather the code used to create the websocket. Without posting your code, ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

i got this too. i ran it in docker. i found there must be lines below in the nginx.conf to make it work location / { proxy_pass http://codeserver.xxx.xxx:8443/; proxy_set_header Host $host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection upgrade; proxy_set_header Accept-Encoding gzip; } this is from https://github.com/cdr/code-server/blob/main/docs/guide.md#using-lets-encrypt-with-nginx
When adding the domain or subdomain for code-server on Nginx Proxy Manager make sure to check the Websockets support to solve the problem.