code-server --version: 3.4.1 / 3.5.0"Could not reconnect" error, I reinstalled code-server many times and I could not find solution for this error.
It seems to disconnect at the same point the terminal would have been loaded.


Could you grab the extension host and code-server logs? https://github.com/cdr/code-server/blob/v3.5.0/doc/FAQ.md#how-do-i-debug-issues-with-code-server
Just as an FYI. I got this same pop up lot with the current version of code server and so reverted to the previous release.
Interesting, there have been a number of reports now that 3.5.0 has this problem while 3.4.1 doesn't. I'll take a look at the differences, maybe something will stand out.
@code-asher You are not able to reproduce I assume? If you don't see anything I'll try to recreate a docker container that would demonstrate it happening regularly. Let me know.
Correct, I haven't been able to reproduce yet. If you can recreate it in a Docker container that would be helpful!
Having a hard time pinning this down but I think it happens predominately when I'm working with python files so I think there might be an interaction there. Packages used are the latest from market place.
I did create a docker file and the easiest way to launch code server from that container is to run the script in the attached zip file. The docker image is vnijs/rsm-msba-cdr and Code Server is started from JypyterLab on port 8989.
launch-rsm-msba-cdr.zip
Python libraries used:
VisualStudioExptTeam.vscodeintellicode-1.2.10.vsix
ms-python.python-2020.9.114305.vsix
ms-python.vscode-pylance-2020.10.0.vsix
The other packages used shown below.
CoenraadS.bracket-pair-colorizer-2-0.2.0.vsix
Ikuyadeu.r-1.4.6.vsix
RDebugger.r-debugger-0.3.1.vsix
REditorSupport.r-lsp-0.1.11.vsix
alefragnani.project-manager-11.3.0.vsix
christian-kohler.path-intellisense-2.3.0.vsix
eamodio.gitlens-10.2.2.vsix
Same issue here. Happens as soon as the window is loaded. Will probably revert back to 3.5.0 for now.
Edit: To clarify, this started happening after upgrading to 3.6.0 for me. 3.5.0 was fine.
Hi, @hanneshayashi . I had the same issue after upgrade to 3.6.0. Resolved it after rebooting my machine.
Same Issue for me on both 3.5.0 & 3.6.0. And it seems that if I use a global VPN, then I can reconnect again. If turn off the VPN, I can only connect for the first time after rebooting, and cannot reconnect after refreshing the page.
I really need the bug fix in v3.6.0, so that I have to add my code-server host ip into my PAC file and let the signal go around the world and finally reach out to my server in the same city. :(
Another finding: I only need VPN to initialize the connecting. Then I can turn the VPN off and hit "reconnect".
Hi, @hanneshayashi . I had the same issue after upgrade to 3.6.0. Resolved it after rebooting my machine.
Well, what do you know, a reboot actually fixed it. Thanks! I don't usually reboot my dev machine after just a software update and I don't really understand why a reboot would be necessary, but you can't argue with results!
The messages/issue is hard to pin down and I don't see anything in "code-server --log trace". It happens sometimes after I install an extension that needs a reload to start working. I can only tell that the error is about to happen the fact that BracketPairColorizer (version 1 because version 2 doesn't work with 3.5 or 3.6) doesn't kick in right away.
https://marketplace.visualstudio.com/items?itemName=CoenraadS.bracket-pair-colorizer
Just tried out 3.6.1. "Cannot reconnect" seems to happen pretty much any time I click an icon in the left navigation bar now. Something about a "handshake timeout" (see below). The docker container I use is vnijs/rsm-msba with the following extensions: https://github.com/radiant-rstats/docker-vsix-dev

DevTools failed to load SourceMap: Could not load content for http://localhost:8989/vscode/static/62735da69466a444561ab9b1115dc7c4d496d455/opt/code-server/dist/pages/pages/vscode.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load SourceMap: Could not load content for chrome-extension://liecbddmkiiihnedobmlmillhodjkdmb/js/content.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load SourceMap: Could not load content for chrome-extension://liecbddmkiiihnedobmlmillhodjkdmb/js/intercom-link-expand-loader.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
abstractExtensionService.ts:836 Extension 'ms-python.python' uses PROPOSED API which is subject to change and removal without notice.
updateEnableProposedApi @ abstractExtensionService.ts:836
_checkEnableProposedApi @ abstractExtensionService.ts:582
_checkEnabledAndProposedAPI @ abstractExtensionService.ts:588
_scanAndHandleExtensions @ extensionService.ts:164
async function (async)
_scanAndHandleExtensions @ extensionService.ts:159
_initialize @ abstractExtensionService.ts:412
(anonymous) @ extensionService.ts:72
Promise.then (async)
k @ extensionService.ts:72
_createInstance @ instantiationService.ts:110
_createServiceInstance @ instantiationService.ts:215
_createServiceInstanceWithOwner @ instantiationService.ts:204
_createAndCacheServiceInstance @ instantiationService.ts:192
_getOrCreateServiceInstance @ instantiationService.ts:135
get @ instantiationService.ts:54
(anonymous) @ workbench.ts:135
invokeFunction @ instantiationService.ts:61
startup @ workbench.ts:131
open @ web.main.ts:96
async function (async)
open @ web.main.ts:75
t.main @ web.main.ts:352
t.create @ workbench.web.api.ts:481
(anonymous) @ workbench.ts:504
(anonymous) @ workbench.ts:405
t._invokeFactory @ loader.js:1129
t.complete @ loader.js:1139
s._onModuleComplete @ loader.js:1760
s._onModuleComplete @ loader.js:1772
s._resolve @ loader.js:1720
s.defineModule @ loader.js:1367
i @ loader.js:1649
l @ loader.js:2163
t._invokeFactory @ loader.js:1129
t.complete @ loader.js:1139
s._onModuleComplete @ loader.js:1760
s._onModuleComplete @ loader.js:1772
s._resolve @ loader.js:1720
s.defineModule @ loader.js:1367
n @ loader.js:1810
(anonymous) @ workbench.nls.js:7
TMScopeRegistry.ts:45 Overwriting grammar scope name to file mapping for scope source.r.
Old grammar file: vscode-remote://localhost:8989/opt/code-server/lib/vscode/extensions/r/syntaxes/r.tmLanguage.json.
New grammar file: vscode-remote://localhost:8989/home/jovyan/.rsm-msba/share/code-server/extensions/ikuyadeu.r-1.5.1/syntax/r.json
register @ TMScopeRegistry.ts:45
s @ TMGrammarFactory.ts:73
_getOrCreateGrammarFactory @ abstractTextMateService.ts:246
async function (async)
_getOrCreateGrammarFactory @ abstractTextMateService.ts:235
(anonymous) @ abstractTextMateService.ts:271
_registerDefinitionIfAvailable @ abstractTextMateService.ts:269
(anonymous) @ abstractTextMateService.ts:151
_handle @ extensionsRegistry.ts:141
acceptUsers @ extensionsRegistry.ts:132
_handleExtensionPoint @ abstractExtensionService.ts:694
_doHandleExtensionPoints @ abstractExtensionService.ts:640
_scanAndHandleExtensions @ extensionService.ts:194
async function (async)
_scanAndHandleExtensions @ extensionService.ts:159
_initialize @ abstractExtensionService.ts:412
(anonymous) @ extensionService.ts:72
Promise.then (async)
k @ extensionService.ts:72
_createInstance @ instantiationService.ts:110
_createServiceInstance @ instantiationService.ts:215
_createServiceInstanceWithOwner @ instantiationService.ts:204
_createAndCacheServiceInstance @ instantiationService.ts:192
_getOrCreateServiceInstance @ instantiationService.ts:135
get @ instantiationService.ts:54
(anonymous) @ workbench.ts:135
invokeFunction @ instantiationService.ts:61
startup @ workbench.ts:131
open @ web.main.ts:96
async function (async)
open @ web.main.ts:75
t.main @ web.main.ts:352
t.create @ workbench.web.api.ts:481
(anonymous) @ workbench.ts:504
(anonymous) @ workbench.ts:405
t._invokeFactory @ loader.js:1129
t.complete @ loader.js:1139
s._onModuleComplete @ loader.js:1760
s._onModuleComplete @ loader.js:1772
s._resolve @ loader.js:1720
s.defineModule @ loader.js:1367
i @ loader.js:1649
l @ loader.js:2163
t._invokeFactory @ loader.js:1129
t.complete @ loader.js:1139
s._onModuleComplete @ loader.js:1760
s._onModuleComplete @ loader.js:1772
s._resolve @ loader.js:1720
s.defineModule @ loader.js:1367
n @ loader.js:1810
(anonymous) @ workbench.nls.js:7
log.ts:197 ERR [remote-connection][ExtensionHost][81bbf鈥[initial][localhost:8989] the handshake took longer than 10 seconds. Error:
log.ts:197 ERR Error: handshake timeout
at remoteAgentConnection.ts:118
log.ts:197 ERR [remote-connection] An error occurred in the very first connect attempt, it will be treated as a permanent error! Error:
log.ts:197 ERR Error: handshake timeout
at remoteAgentConnection.ts:118
extensionHostManager.ts:74 Error received from starting extension host
(anonymous) @ extensionHostManager.ts:74
Promise.then (async)
e @ extensionHostManager.ts:68
_createInstance @ instantiationService.ts:110
createInstance @ instantiationService.ts:76
(anonymous) @ abstractExtensionService.ts:447
_startExtensionHosts @ abstractExtensionService.ts:446
_initialize @ abstractExtensionService.ts:410
(anonymous) @ extensionService.ts:72
Promise.then (async)
k @ extensionService.ts:72
_createInstance @ instantiationService.ts:110
_createServiceInstance @ instantiationService.ts:215
_createServiceInstanceWithOwner @ instantiationService.ts:204
_createAndCacheServiceInstance @ instantiationService.ts:192
_getOrCreateServiceInstance @ instantiationService.ts:135
get @ instantiationService.ts:54
(anonymous) @ workbench.ts:135
invokeFunction @ instantiationService.ts:61
startup @ workbench.ts:131
open @ web.main.ts:96
async function (async)
open @ web.main.ts:75
t.main @ web.main.ts:352
t.create @ workbench.web.api.ts:481
(anonymous) @ workbench.ts:504
(anonymous) @ workbench.ts:405
t._invokeFactory @ loader.js:1129
t.complete @ loader.js:1139
s._onModuleComplete @ loader.js:1760
s._onModuleComplete @ loader.js:1772
s._resolve @ loader.js:1720
s.defineModule @ loader.js:1367
i @ loader.js:1649
l @ loader.js:2163
t._invokeFactory @ loader.js:1129
t.complete @ loader.js:1139
s._onModuleComplete @ loader.js:1760
s._onModuleComplete @ loader.js:1772
s._resolve @ loader.js:1720
s.defineModule @ loader.js:1367
n @ loader.js:1810
(anonymous) @ workbench.nls.js:7
extensionHostManager.ts:75 Error: handshake timeout
at remoteAgentConnection.ts:118
(anonymous) @ extensionHostManager.ts:75
Promise.then (async)
e @ extensionHostManager.ts:68
_createInstance @ instantiationService.ts:110
createInstance @ instantiationService.ts:76
(anonymous) @ abstractExtensionService.ts:447
_startExtensionHosts @ abstractExtensionService.ts:446
_initialize @ abstractExtensionService.ts:410
(anonymous) @ extensionService.ts:72
Promise.then (async)
k @ extensionService.ts:72
_createInstance @ instantiationService.ts:110
_createServiceInstance @ instantiationService.ts:215
_createServiceInstanceWithOwner @ instantiationService.ts:204
_createAndCacheServiceInstance @ instantiationService.ts:192
_getOrCreateServiceInstance @ instantiationService.ts:135
get @ instantiationService.ts:54
(anonymous) @ workbench.ts:135
invokeFunction @ instantiationService.ts:61
startup @ workbench.ts:131
open @ web.main.ts:96
async function (async)
open @ web.main.ts:75
t.main @ web.main.ts:352
t.create @ workbench.web.api.ts:481
(anonymous) @ workbench.ts:504
(anonymous) @ workbench.ts:405
t._invokeFactory @ loader.js:1129
t.complete @ loader.js:1139
s._onModuleComplete @ loader.js:1760
s._onModuleComplete @ loader.js:1772
s._resolve @ loader.js:1720
s.defineModule @ loader.js:1367
i @ loader.js:1649
l @ loader.js:2163
t._invokeFactory @ loader.js:1129
t.complete @ loader.js:1139
s._onModuleComplete @ loader.js:1760
s._onModuleComplete @ loader.js:1772
s._resolve @ loader.js:1720
s.defineModule @ loader.js:1367
n @ loader.js:1810
(anonymous) @ workbench.nls.js:7
@code-asher FYI I have been playing around with 3.6.2 for a few hours now in a docker container. I haven't seen any "reconnect" issues! Also, all extensions I have tried (incl python) seem to work! Well, except for Bracket-pair-colorizer-2 that is :)
Yes!! I'm relieved to hear that. Thank you for testing it out.
Hopefully I'll have time to fix the bracket colorizer plugin soon
(most likely it will be next week).
Closing for now, if anyone sees more connection failures please let me know. Will use https://github.com/cdr/code-server/issues/2197 to track the bracket plugin issue.
Most helpful comment
Interesting, there have been a number of reports now that 3.5.0 has this problem while 3.4.1 doesn't. I'll take a look at the differences, maybe something will stand out.