GitHub Issue

Port collision with Ollama: mlx_lm.server fails to bind on 11434

Discovered On Apr 29, 2026
Primary Metric open
## Summary `npm run dev` fails to start the bundled `mlx_lm.server` when Ollama is also running, because both default to port **11434**. The MLX server hits `OSError: [Errno 48] Address already in use` and the chat never becomes ready. ## Repro 1. Have Ollama installed and running (default install puts its server on `127.0.0.1:11434`). 2. `npm run dev` 3. Electron window opens but model server crashes during startup. ## Observed error ``` OSError: [Errno 48] Address already in use File ".../site-packages/mlx_lm/server.py", line 1984, in File ".../socketserver.py", line 456, in __init__ File ".../socketserver.py", line 472, in server_bind ``` (Verified via `lsof -nP -iTCP:11434 -sTCP:LISTEN` showing `ollama` holding the port.) ## Root cause `src/main/mlx.ts:6` hardcodes: ```ts const MLX_PORT = 11434 ``` 11434 is also Ollama's well-known default port, so any user who runs both tools will collide. There is no fallback, port-scan, or user-facing surfacing of the bind failure — the Python traceback is only visible in the dev console. ## Suggested fix 1. **Default off Ollama's port.** Move the default to something less contested (e.g. `11534` or an ephemeral port). 2. **Auto-select a free port at startup.** Probe a small range (e.g. 11434–11444) and pick the first open one, falling back to an OS-assigned ephemeral port. Pass the chosen port to both the spawned `mlx_lm.server` and the renderer's API client. 3. **Surface bind failures** to the UI instead of...
View Raw Thread