'In VSCode Remote Development, Resolve error saying "Cannot read property 'split' of undefined" occurs
I'd like to use Visual Studio Code (VSCode) Remote Development extensions.
I tried "Remote-SSH: Connect to Host" command, and it seems the SSH connection to the host server correctly established.
However, I encountered an error saying:
Could not establish connection to "<hostname>". Cannot read property 'split' of undefined.
When I look into the output messages, the error occurs like this:
[10:13:08.492] Using cwd: vscode-remote://ssh-remote%2B<hostname>/
[10:13:08.492] Remote extension host environment: {"SSH_AUTH_SOCK":"/tmp/vscode-ssh-auth-sock-<id?>"}
[10:13:08.512] Resolver error: Cannot read property 'split' of undefined
My environment is like this:
- macOS Catalina (10.15.6)
- Visual Studio Code (1.48.2)
- Remote Development extension (v0.20.0)
I appreciate it if you help me solve this matter.
Solution 1:[1]
Thank you for checking my question.
I was able to resolve this issue by modifying my ssh config.
I had used a LocalForward setting in multi-stage ssh as below.
Host <ssh_hostname>
HostName <hostname>
User <usename>
LocalForward <port_A> localhost:<port_B>
ProxyCommand ssh -CW %h:%p <other_ssh_hostname>
RemoteForward <port_C> localhost:<port_D>
I commented out the LocalFoward setting, and it works!
Host <ssh_hostname>
HostName <hostname>
User <usename>
# LocalForward <port_A> localhost:<port_B>
ProxyCommand ssh -CW %h:%p <other_ssh_hostname>
RemoteForward <port_C> localhost:<port_D>
I don't know why using LocalForward caused the problem, but able to solve it for the time being.
Thank you again.
Solution 2:[2]
I don't exactly understand why this issue occurrs. But, I was able to overcome this problem by deleting a file which it uses for persisting the connection details. You can see the path to this file in the vscode OUTPUT tab.
The filepath would be similar to this one(Path on MacOS):
/Users/xxxxxx/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-d1856b0f-aaaaa2d23e12e5afa3e5c21c1c7abc4657061234-0.66.1/data.json
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Yusuke Mori |
| Solution 2 | Soma Siddhartha |
