VS Code Connection (Windows/WSL)

View as Markdown

This guide helps you configure VS Code to connect to Brev instances when using Windows with WSL (Windows Subsystem for Linux).

Platform: Windows with WSL (Ubuntu or similar)

Problem

When running the following command to open a Brev instance in VS Code:

$brev open <instance_name> code

The connection fails with errors such as:

posix_spawnp: No such file or directory
WARN: $PLATFORM is undefined in installation script output
Failed to parse remote port from server output
Resolver error: Error

VS Code does not successfully establish an SSH session to the instance.

Root Cause

When launching VS Code from WSL (for example, via brev open <instance_name> code), the editor runs as a Windows application and uses the Windows SSH client by default.

Although the .brev directory (SSH config and private key) is correctly synced from WSL to Windows, the cloudflared binary is not available to the Windows SSH client. Cloudflare Tunnel requires cloudflared to be executed as part of the SSH ProxyCommand, which Windows SSH cannot do when the binary exists only inside WSL.

As a result, VS Code fails to connect to Brev instances that depend on Cloudflare Tunnel-based SSH access.

Prerequisites

  • Windows host with VS Code installed
  • WSL (for example, Ubuntu) configured and functional
  • Brev CLI installed and authenticated in WSL

Solution

Configure VS Code to use the WSL SSH client instead of the Windows SSH client.

1

Create a wrapper BAT file

Create a file on Windows (for example, C:\Users\<username>\wsl-ssh.bat) with the following content:

1C:\Windows\System32\wsl.exe ssh %*

This wrapper redirects SSH commands invoked by VS Code to the WSL SSH client.

2

Open VS Code settings

  1. Open VS Code
  2. Press Ctrl+, to open Settings
  3. Search for “remote.SSH.path”
3

Configure the SSH path

Set the Remote > SSH: Path setting to the full Windows path of the wsl-ssh.bat file you created:

C:\Users\<username>\wsl-ssh.bat

Replace <username> with your Windows username.

4

Save and restart

  1. Save the settings
  2. Restart VS Code

Verification

After completing the configuration:

$brev open <instance_name> code
  • VS Code successfully connects to the instance over SSH
  • Cloudflare Tunnel-based connections work without posix_spawnp or SSH binary errors
  • You can browse files and use the integrated terminal on the remote instance

Rollback

To revert to the default configuration:

  1. Open VS Code Settings
  2. Search for “remote.SSH.path”
  3. Clear the value to restore the default
  4. Restart VS Code

Workaround

If you cannot configure VS Code, use a terminal-based SSH connection from WSL instead:

$brev shell <instance_name>

This provides full terminal access to the instance without requiring VS Code Remote SSH integration.