[BUG(preview)] autoPort not working in Code on Claude Desktop

Resolved 💬 3 comments Opened Feb 26, 2026 by yoavf Closed Mar 3, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

autoPort: true doesn't work as documented.

When port 3000 is in use, Desktop still passes PORT=3000 instead of finding a free port.

What Should Happen?

As per the documentation, if autoPort=true and the port is taken, it should find a free port and pass it as PORT to the defined command.

Error Messages/Logs

Steps to Reproduce

This is the start script I was using

         {
           "version": "0.0.1",
          "autoVerify": true,
           "configurations": [
             {
              "name": "dev",
              "runtimeExecutable": "bash",
              "runtimeArgs": ["./scripts/desktop-preview.sh"],
              "port": 3000,
              "autoPort": true
           }
       }
`

### Claude Model

None

### Is this a regression?

I don't know

### Last Working Version

_No response_

### Claude Code Version

Claude 1.1.4328 (d8e391) 2026-02-25T17:04:36.000Z

### Platform

Other

### Operating System

macOS

### Terminal/Shell

Other

### Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗