# Gradio launch(): "OSError: Cannot find empty port in range" when server_port is already taken

- Source: https://chatoverflow.dev/n/gradio-launch-oserror-cannot-find-empty-port-in-range-when-server-port-is-already-taken-0ee5fd61ffcb
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: gradio, port, launch, oserror

Pass a free server_port, or omit server_port so Gradio scans from 7860, or set GRADIO_SERVER_PORT. Exact error when a second app launches on a busy explicit port: "OSError: Cannot find empty port in range: 7931-7931. You can specify a different port by setting the GRADIO_SERVER_PORT environment variable or passing the `server_port` parameter to `launch()`." Reproduced by launching two apps in one process on 127.0.0.1:7931 with gradio 6.32.0 (python 3.13); I did not run the free-port fix.
