VS code remote connection: Cannot read properties of undefined (reading 'replace') - visual-studio-code

VScode Error message
[18:33:55.749] Resolver error: TypeError: Cannot read properties of undefined (reading 'replace')
at Object.a [as sanitizeConnectionToken] (/Users/username/.vscode/extensions/ms-vscode-remote.remote-ssh-0.84.0/out/extension.js:1:691806)
at Object.C [as findRunningServer] (/Users/username/.vscode/extensions/ms-vscode-remote.remote-ssh-0.84.0/out/extension.js:1:626542)
at async /Users/username/.vscode/extensions/ms-vscode-remote.remote-ssh-0.84.0/out/extension.js:1:622510
at async T (/Users/username/.vscode/extensions/ms-vscode-remote.remote-ssh-0.84.0/out/extension.js:1:619351)
at async Object.t.resolveWithLocalServer (/Users/username/.vscode/extensions/ms-vscode-remote.remote-ssh-0.84.0/out/extension.js:1:622460)
at async Object.t.resolve (/Users/username/.vscode/extensions/ms-vscode-remote.remote-ssh-0.84.0/out/extension.js:1:644834)
at async /Users/username/.vscode/extensions/ms-vscode-remote.remote-ssh-0.84.0/out/extension.js:1:727082
[18:33:55.751] ------
How to reproduce
Keep the remote connection in VScode
AFK (away from keyboard)
When the connection naturally breaks, then retry to connect
The error message will occur.
I found that one solution is to remove VScode cache at
/Users/username/Library/Application\ Support/Code
But this is definitely not the right way, any one knows the root cause and how to solve it?

I was able to fix this problem by upgrading the remote SSH extension version to the pre-release version.

Unfortunately, upgrading the remote SSH extension version to the pre-release version did not help me. What helped me though is a suggestion mentioned by Lilei Zheng:
I enabled "Remote Server Listen On Socket" option and it worked good so far.
This option is located in the "Remote - SSH" Extension Settings. I enabled it and I never had such problems again.

Related

Unable to establish connection to remote: spawn ENOTDIR

I am using VS code Remote-SSH to connect to the remote machines to modify the files. Currently upon trying to connect the Remote-SSH: Connect to host. I get the error message," Could not establish connection to "": spawn ENOTDIR.
The full error log is as follows:
[09:29:43.567] Log Level: 2
[09:29:43.568] remote-ssh#0.65.1
[09:29:43.568] darwin arm64
[09:29:43.569] SSH Resolver called for "ssh-remote+xps", attempt 1
[09:29:43.569] "remote.SSH.useLocalServer": true
[09:29:43.569] "remote.SSH.sshPath": undefined
[09:29:43.569] "remote.SSH.sshConfigurationFile": undefined
[09:29:43.569] "remote.SSH.useFlock": true
[09:29:43.569] "remote.SSH.lockfilesInTmp": false
[09:29:43.569] "remote.SSH.localServerDownload": auto
[09:29:43.569] "remote.SSH.remoteServerListenOnSocket": false
[09:29:43.570] "remote.SSH.showLoginTerminal": false
[09:29:43.570] "remote.SSH.defaultExtensions": []
[09:29:43.570] SSH Resolver called for host: xps
[09:29:43.570] Setting up SSH remote "xps"
[09:29:43.571] Acquiring local install lock: /var/folders/jf/rk7bz0g157x7yd5q_f726zyr0000gn/T/vscode-remote-ssh-xps-install.lock
[09:29:43.592] Looking for existing server data file at /Users/taramishra/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-xps-f30a9b73e8ffc278e71575118b6bf568f04587c8-0.65.1/data.json
[09:29:43.592] Using commit id "f30a9b73e8ffc278e71575118b6bf568f04587c8" and quality "stable" for server
[09:29:43.594] Install and start server if needed
[09:29:43.595] Checking ssh with "ssh -V"
[09:29:43.596] Finding installed ssh failed: spawn ENOTDIR
[09:29:43.599] Resolver error: Error: spawn ENOTDIR
at ChildProcess.spawn (internal/child_process.js:407:11)
at Object.spawn (child_process.js:557:9)
at /Users/taramishra/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.1/out/extension.js:1:141985
at new Promise (<anonymous>)
at k (/Users/taramishra/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.1/out/extension.js:1:141906)
at I (/Users/taramishra/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.1/out/extension.js:1:141857)
at /Users/taramishra/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.1/out/extension.js:1:145959
at _ (/Users/taramishra/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.1/out/extension.js:1:146024)
at C (/Users/taramishra/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.1/out/extension.js:1:141636)
at Object.t.getSshCommandPath (/Users/taramishra/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.1/out/extension.js:1:144744)
at Function.create (/Users/taramishra/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.1/out/extension.js:1:262426)
at async Object.t.tryInstallWithLocalServer (/Users/taramishra/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.1/out/extension.js:1:387852)
at async /Users/taramishra/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.1/out/extension.js:1:293749
at async Object.t.withShowDetailsEvent (/Users/taramishra/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.1/out/extension.js:1:407055)
at async /Users/taramishra/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.1/out/extension.js:1:387177
at async N (/Users/taramishra/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.1/out/extension.js:1:383945)
at async Object.t.resolveWithLocalServer (/Users/taramishra/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.1/out/extension.js:1:386804)
at async Object.t.resolve (/Users/taramishra/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.1/out/extension.js:1:297790)
at async /Users/taramishra/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.1/out/extension.js:127:110485
[09:29:43.601] ------
I have tried to reinstall the Remote-Development packages and also cleared up the .vscode-server files in the remote. They do not seem to help.
Any idea how I can resolve this issue?
Coincidentally, I had this problem with my VSCode just today as well! For me, it just stopped working today all of a sudden (may have something to do with the latest VScode update). The problem is that VSCode can no longer find your ssh program, which it was previously able to do.
Go to your Remote-SSH preferences (cmd + , and search for remote-ssh).
Find the field labeled Remote.SSH: Path. Right now it's probably blank for you because VSCode used to find the executable by itself.
Input the absolute path to your ssh executable. If you are unsure of the path, you can run which ssh in your terminal and copy the path it prints out.
Save your settings, and retry the ssh. Worked for me!

Can't connect remotely using Remote-SSH: "spawn UNKNOWN"

I'm trying to remotely connect to a server (running on Ubuntu 16.04.7 LTS) through VSCode (started on WSL).
I've set the path to my WSL Config file (with the SSH keys inside) in VSCode Remote-SSH.
I can reach and connect to the server through the terminal as well as the VSCode terminal.
Yet, when trying to connect through Remote-SSH I'm getting the message
Failed to connect to the remote extension host server (Error: spawn UNKNOWN)
with the following error log:
[13:50:42.906] Log Level: 2
[13:50:42.922] remote-ssh#0.56.0
[13:50:42.922] win32 x64
[13:50:42.925] SSH Resolver called for "ssh-remote+<net>.net", attempt 1
[13:50:42.925] SSH Resolver called for host: <net>.net
[13:50:42.926] Setting up SSH remote "<net>.net"
[13:50:42.970] Using commit id "<CommitID>" and quality "stable" for server
[13:50:42.974] Install and start server if needed
[13:50:44.876] Checking ssh with "ssh -V"
[13:50:44.888] Finding installed ssh failed: spawn UNKNOWN
[13:50:44.897] Resolver error: Error: spawn UNKNOWN
at ChildProcess.spawn (internal/child_process.js:394:11)
at Object.spawn (child_process.js:549:9)
at c:\Users\<user>\.vscode\extensions\ms-vscode-remote.remote-ssh-0.56.0\out\extension.js:1:242426
at new Promise (<anonymous>)
at q (c:\Users\<user>\.vscode\extensions\ms-vscode-remote.remote-ssh-0.56.0\out\extension.js:1:242347)
at k (c:\Users\<user>\.vscode\extensions\ms-vscode-remote.remote-ssh-0.56.0\out\extension.js:1:242298)
at _ (c:\Users\<user>\.vscode\extensions\ms-vscode-remote.remote-ssh-0.56.0\out\extension.js:1:245580)
at P (c:\Users\<user>\.vscode\extensions\ms-vscode-remote.remote-ssh-0.56.0\out\extension.js:1:245741)
at O (c:\Users\<user>\.vscode\extensions\ms-vscode-remote.remote-ssh-0.56.0\out\extension.js:1:242117)
at C (c:\Users\<user>\.vscode\extensions\ms-vscode-remote.remote-ssh-0.56.0\out\extension.js:1:242026)
at Object.t.generateMultiLineCommand (c:\Users\<user>\.vscode\extensions\ms-vscode-remote.remote-ssh-0.56.0\out\extension.js:1:243396)
at q (c:\Users\<user>\.vscode\extensions\ms-vscode-remote.remote-ssh-0.56.0\out\extension.js:127:107623)
at c:\Users\<user>\.vscode\extensions\ms-vscode-remote.remote-ssh-0.56.0\out\extension.js:127:105016
at processTicksAndRejections (internal/process/task_queues.js:94:5)
at async Object.t.withShowDetailsEvent (c:\Users\<user>\.vscode\extensions\ms-vscode-remote.remote-ssh-0.56.0\out\extension.js:127:110096)
at async Object.t.resolve (c:\Users\<user>\.vscode\extensions\ms-vscode-remote.remote-ssh-0.56.0\out\extension.js:127:108158)
at async c:\Users\<user>\.vscode\extensions\ms-vscode-remote.remote-ssh-0.56.0\out\extension.js:127:143767
[13:50:44.908] ------
Already tried setting up manually the vscode server remotely as suggested here
Thanks in advance for any help!
Seems things got messed up with the update.
I fixed it by reinstalling the Remote SSH extension: ms-vscode-remote.remote-ssh and reloading as you will be instructed to do.
I also just installed the entire Remote Development extension: ms-vscode-remote.vscode-remote-extensionpack and reloaded vscode as instructed by vscode.
Before this though, I deleted (rm -rf) the contents of /home/<your_username>/.vscode-server/ bin/ and data/
Had the same problem.
After trying everything, the only thing that worked 100% was just killing vs-code and opening it again.

Extension host terminated unexpectedly. Code: 0 Signal: null abstractExtensionService.ts:155

I have this problem with my VS code(V1.43.2). I keep getting this error 'Extension host terminated unexpectedly.' When I open the developer tools to see where the error is I see these below errors
ERR Language client is not ready yet: Error: Language client is not ready yet
at t.LanguageClient.sendRequest (c:\Users\cc612417\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\html-language-features\client\dist\htmlMain.js:1:42925)
the other errors I see are
abstractExtensionService.ts:155 Extension host terminated unexpectedly. Code: 0 Signal: null
notificationsAlerts.ts:40 Extension host terminated unexpectedly.
I have tried disabling all the extension, I even uninstalled all the extension just to be sure but the error persists. Even when I opened VS code with parameter that disables all the extension --disable-extensions, the error persists. This error causes a lot of VS code features not to work, like code formatting, source control integration etc., I have tried updating it to the latest version as well.
Could you please help with this ?

how can I solve this error in ionic `You must specify a "protocol" for the proxy type`

I ran ionic start series sidetabs in my Windows and got this error
TypeError: You must specify a "protocol" for the proxy type (http, https, socks, socks4, socks4a, socks5, socks5h, pac+data, pac+file, pac+ftp, pac+http, pac+https)
at new ProxyAgent (C:\Users\sato\AppData\Roaming\npm\node_modules\#ionic\cli-plugin-proxy\node_modules\proxy-agent\index.js:97:11)
at ProxyAgent (C:\Users\sato\AppData\Roaming\npm\node_modules\#ionic\cli-plugin-proxy\node_modules\proxy-agent\index.js:81:45)
at Request.proxy (C:\Users\sato\AppData\Roaming\npm\node_modules\#ionic\cli-plugin-proxy\node_modules\superagent-proxy\index.js:71:15)
at C:\Users\sato\AppData\Roaming\npm\node_modules\ionic\node_modules\#ionic\cli-utils\lib\http.js:31:17
at Generator.next (<anonymous>)
at fulfilled (C:\Users\sato\AppData\Roaming\npm\node_modules\ionic\node_modules\tslib\tslib.js:102:62)
at <anonymous>
How do I solve this?
For Windows, enter the SET command without quotes. The plugin cannot identify the protocol from the url if the text contains quotes. Might get fixed in future. As of now, this worked for me,
set HTTP_PROXY=http://proxy.company.com:port-number
set HTTPS_PROXY=http://proxy.company.com:port-number
set IONIC_HTTP_PROXY=http://proxy.company.com:port-number
set PROXY=http
This applies if your proxy is an HTTP proxy. If you have a SOCK proxy, you need to edit accordingly changing the url and proxy=sock
my problem was solved with the command npm config unset -g proxy

Eclipse JDWP error when trying to debug

I get the following error when trying to debug a local java application in eclipse.
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
ERROR: transport error 202: connect failed: Connection refused
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:690]
I read that it might be caused by something using the same port as the one eclipse wants to use for debugging, but how do I determine the port number. I couldn't find anything in the error log or the preferences.
Any ideas?
I ran into the same issue and it turns out I was specifying server=n parameter in the jdwp debug string. It turns out that if we specify server=n in the debug connection string, it'll attempt to attach/connect to that port instead of listening on it. Switching to server=y solved my issue. It's documented in the
official jpda documentation.
Maybe it's your antivirus. Are you using avast if so look at this https://feedback.avast.com/responses/eclipse-debug-functionality-not-working-after-upgrade-to-avast-2014
The solution is upgrading to the latest version of avast (http://forum.avast.com/index.php?topic=139606.0)
Please ensure that, the below entry is there in /etc/hosts file (for mac/linux)
127.0.0.1 localhost
Previously I unknowingly commented out this line, so it worked for me after reverting back. Hope this helps.