How to Fix the Qoder Remote-SSH "Premature close" Error on Windows

If you're a developer using the Qoder editor, you know how powerful its remote development features are. But if you’ve tried connecting to a server through a proxy like Cloudflare Tunnel, you may have hit a brick wall: the stubborn and cryptic Error: Premature close.

You’ve checked your SSH config, your keys are correct, and you can even connect perfectly using a standard terminal or another editor. Yet, Qoder stubbornly fails with a log that looks like this:

[Info] Connecting to user@your-server...
[Error] Error resolving authority
Error: Premature close

After trying all the standard fixes, the error remains. This guide will walk you through the deep-dive diagnostic process that uncovered a hidden bug specific to how Qoder's SSH client runs on Windows, and the clever workaround that finally solved it.

The Breakthrough: Capturing the Real Error

The logs within Qoder don't always tell the full story. The real error is often silenced by the proxy process that fails. The trick is to force the ProxyCommand to write its own errors to a log file.

We modified the ~/.ssh/config file to redirect any errors from the proxy to a text file:

Host your-server.com
  HostName your-server.com
  User your-user
  # The '2>' redirects any errors to a file for us to read
  ProxyCommand C:\path\to\cloudflared.exe access ssh --hostname %h 2> C:\Users\YourUser\proxy_error.log

After trying to connect again, the proxy_error.log file was created. Inside was the smoking gun:

'exec' is not recognized as an internal or external command,
operable program or batch file.

The Root Cause: A Linux Command on a Windows Machine

This error revealed everything. The SSH client built into this version of Qoder was designed with Linux/macOS in mind. On those systems, it’s common to prepend shell commands with exec to replace the current process.

The client was incorrectly taking our Windows ProxyCommand and prepending exec to it, creating an invalid command: exec C:\path\to\cloudflared.exe....

The Windows Command Prompt has no idea what exec is, so it failed instantly. This immediate failure is what closed the connection and triggered the "Premature close" error in Qoder's log.

A Note for VS Code Users: Because Qoder is a fork of VS Code and they share the underlying Remote - SSH extension, this solution may also work for you. If you have a ProxyCommand setup and have tried all the common fixes (like useExecServer) without success, this rare exec bug might be your issue as well.

The Solution: Giving Windows the exec Command It Wants

Since we couldn't change Qoder's buggy behavior, we changed the environment instead. If the editor insists on calling exec, we can create a command named exec for it to find.

This is done by creating a simple batch script "shim."

Step 1: Create a Scripts Folder

First, create a clean, central location for our script. A good choice is C:\Scripts.

Step 2: Create the exec.bat File

Inside C:\Scripts, create a new file named exec.bat. Be sure to remove the .txt extension. Open the file in a text editor and add this single line of code:

@%*

This is a piece of batch script magic. @ prevents the command from being printed, and %* is a special variable that represents all arguments passed to the script. When Qoder calls exec cloudflared.exe --options, our script runs, discards the "exec" part, and executes the rest of the line: cloudflared.exe --options.

Step 3: Add the Folder to your System PATH

For Windows to find our new command, its folder must be in the system's PATH.

  1. Press the Windows Key, type env, and select "Edit the system environment variables".
  2. Click the "Environment Variables..." button.
  3. Under "System variables," select the Path variable and click "Edit...".
  4. Click "New" and add the path to our folder: C:\Scripts.
  5. Click OK on all windows to save the changes.

Step 4: Restart Qoder (Crucial Step)

Applications load the PATH variable on startup. You must completely close and restart Qoder for it to recognize the new PATH and find your exec.bat file.

After restarting, your connection should now work perfectly. Qoder will make its faulty call to exec, your shim will catch it, and the correct ProxyCommand will run, finally establishing the remote connection. Happy remote coding!