Cannot Attach Visual Studio Code: Error running command remote-containers.attachToRunningContainerFromViewlet
VSCode version: 1.83.0
Local OS: macOS 13.5.1 (22G90)
Remote OS: Cent OS 7
Remote Docker version: Docker version 24.0.2, build cb74dfc
Previously, the remote-ssh and devcontainer works fine. I could attach vs-code through docker plugin successfully. However, right now when I try to "Attach Visual Studio Code", I will get the following error:
Error running command remote-containers.attachToRunningContainerFromViewlet: The operation was aborted. This is likely caused by the extension that contributes remote-containers.attachToRunningContainerFromViewlet.
I check the output logs and will see following messages in Extension Host
2023-10-05 17:22:03.792 [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-containers, startup: false, activationEvent: 'onStartupFinished' 2023-10-05 17:22:41.908 [error] Error: The operation was aborted at Socket.<anonymous> (/Users/xuwenhao/.vscode/extensions/ms-vscode-remote.remote-ssh-0.106.4/out/extension.js:2:137555) at Object.onceWrapper (node:events:628:26) at Socket.emit (node:events:525:35) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) remote-containers.attachToRunningContainerFromViewlet {"value":"ms-vscode-remote.remote-containers","_lower":"ms-vscode-remote.remote-containers"} 2023-10-05 17:22:42.911 [error] TypeError: Cannot use 'in' operator to search for 'result' in 72 at /Users/xuwenhao/.vscode/extensions/ms-vscode-remote.remote-ssh-0.106.4/out/extension.js:2:137281 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) 2023-10-05 17:22:45.222 [info] [resolveAuthority(ssh-remote,2)][0ms] activating remote resolvers ssh-remote+124.220.41.13
And following logs in Remote -SSH
[17:22:45.842] Remote server is listening on port 33109 [17:22:45.842] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":33109},"osReleaseId":"tencentos","arch":"x86_64","webUiAccessToken":"","sshAuthSock":"","display":"","tmpDir":"/run/user/1000","platform":"linux","connectionToken":"1aa11a11-a111-11aa-11aa-111111aaa1a1"},"installUnpackCode":""} [17:22:45.843] Persisting server connection details to /Users/xuwenhao/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-5fa0150d-e7e037083ff4455cf320e344325dacb480062c3c-0.106.4/data.json [17:22:45.844] Starting forwarding server. local port 53505 -> socksPort 53367 -> remotePort 33109 [17:22:45.844] Forwarding server listening on port 53505 [17:22:45.844] Waiting for ssh tunnel to be ready [17:22:45.845] [Forwarding server port 53505] Got connection 0 [17:22:45.845] Tunneled port 33109 to local port 53505 [17:22:45.845] Resolved "ssh-remote+124.220.41.13" to "port 53505" [17:22:45.849] ------ [17:22:45.871] [Forwarding server port 53505] Got connection 1 [17:22:48.785] > local-server-2> Timed out [17:22:48.789] Local server exit: 0 [17:23:20.281] [Forwarding server port 53505] Got connection 2
I could still remote-ssh the host server successfully, and can also "Attach Shell" successfully. And I could also using ssh tunnel to connect to the docker image.
The only thing didn't work is the combination of remote-ssh + devcontainer.
Same problem here, several members of the team are reporting the same issue, not only with macOs in the client but also with Ubuntu.
same problem with ubuntu 22.04 , attaching vscode to running docker suddenly stop working Local OS : Windows 11 Remote OS : ubuntu 22.04 VS code : 1.83.0
Error running command remote-containers.attachToRunningContainerFromViewlet: The operation was aborted. This is likely caused by the extension that contributes remote-containers.attachToRunningContainerFromViewlet.
Same problem after an update.
Local OS: Windows 11 Pro 22H2 Remote OS: Ubuntu 20.04 VScode : 1.83.0
Same here
Version: 1.83.0
Commit: e7e037083ff4455cf320e344325dacb480062c3c
Date: 2023-10-03T16:11:49.843Z
Electron: 25.8.4
ElectronBuildId: 24154031
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Linux x64 5.11.0-46-generic
This fix worked for me. https://github.com/microsoft/vscode-remote-release/issues/9064#issuecomment-1747913455
I'll transfer this to the Dev Containers extension's issue repository.
Possible dupe of #9064
mfrigo
Also works for me
Same problem after upgrading to 1.83.0 in the case the information is not clear (at least in my case) : it's when already connected to remote ssh then attaching vscode to a container using the container extension. this functionality is so nice when working !
Same here with Docker extension v1.26.1. It was work 2 days ago and suddenly fail yesterday.
in my case it helped when i uninstalled the extension and removed the following folders:
rm -rf
/home/user/.vscode/extensions/ms-vscode-remote.remote-containers*
/home/user/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers
/tmp/devcontainers*
/home/user/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers*
It suddenly failed again, but I find a way to avoid this bug, we can custom a code-workspace file.
- encode your remote container config setting:
echo -n '{"containerName":"/your_docker_name","settings":{"host":"ssh://[email protected]"}}' | xxd -p | tr -d '\n'
7b22636f6e7461696e65724e616d65223a222f796f75725f646f636b65725f6e616d65222c2273657474696e6773223a7b22686f7374223a227373683a2f2f757365726e616d654031302e392e382e37227d7d
- verify it
echo "7b22636f6e7461696e65724e616d65223a222f796f75725f646f636b65725f6e616d65222c2273657474696e6773223a7b22686f7374223a227373683a2f2f757365726e616d654031302e392e382e37227d7d" | xxd -r -p
{"containerName":"/your_docker_name","settings":{"host":"ssh://[email protected]"}}
- create
proj.code-workspacefile, copy encoded string intouriandremoteAuthority:
{
"folders": [
{
"uri": "vscode-remote://attached-container+7b22636f6e7461696e65724e616d65223a222f796f75725f646f636b65725f6e616d65222c2273657474696e6773223a7b22686f7374223a227373683a2f2f757365726e616d654031302e392e382e37227d7d/root/"
}
],
"remoteAuthority": "attached-container+7b22636f6e7461696e65724e616d65223a222f796f75725f646f636b65725f6e616d65222c2273657474696e6773223a7b22686f7374223a227373683a2f2f757365726e616d654031302e392e382e37227d7d",
"settings": {
}
}
- save it and open it by vscode.