You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Improve UX for Port Conflicts - Show Clear Error Instead of Freezing #19272
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Summary
When launching multiple OpenCode instances with a fixed server port configured, the second instance can freeze without any feedback. This creates confusion and makes it appear as though the tool is unresponsive or single-session only.
Problem
If a user configures a fixed port (e.g. "server": { "port": 4096}) and then starts a second OpenCode instance:
The port is already in use by the first instance
The second instance attempts to bind to the same port
Instead of failing gracefully, the process appears to hang/freeze with no message
Important:
Even when running with maximum verbosity:
opencode --log-level DEBUG
there is no output, error, or diagnostic message indicating that a port conflict has occurred.
This results in:
Poor developer experience (unclear what went wrong)
Misleading behavior (looks like OpenCode does not support multiple sessions)
Debugging difficulty (even DEBUG logs provide no signal)
Time wasted investigating unrelated causes
Expected Behavior
When the configured port is already in use, OpenCode should:
Fail fast instead of hanging
Display a clear, actionable error message, e.g.:
Error: Port 4096 is already in use.
Another OpenCode instance may already be running.
You can:
- Stop the existing instance
- Use a different port (e.g. --port 4097)
- Remove the fixed port from your config to allow auto-assignment
Ensure the error is visible at all log levels, including default and DEBUG
Proposed Enhancements (Optional)
Add a --port auto fallback mode:
If the configured port is busy, automatically pick the next available port
Emit explicit logs during server startup (e.g. “binding to port…”)
Detect and display the PID/process holding the port (if feasible)
Add a pre-flight port availability check before attempting to start
Impact
This change would:
Prevent confusion for new users
Improve reliability perception
Make DEBUG logging actually useful for troubleshooting
Reduce support/debugging overhead
Align behavior with standard CLI/server UX expectations
Environment
OpenCode version: 1.3.0
OS: Linux
Config:
{
"server": {
"port": 4096
}
}
Repro Steps
Configure a fixed port in config.json
Start OpenCode in one folder
Start OpenCode in another folder
Observe second instance freezing with no output
Retry with --log-level DEBUG → still no indication of port conflict
Activity
github-actions commentedon Mar 26, 2026
This issue might be a duplicate of existing issues. Please check:
--auto-portfallback enhancementgithub-actions commentedon Jul 5, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.