Skip to content

docs: document the service port and hostname settings - #62755

Closed
mariaa144 wants to merge 1 commit into
anomalyco:devfrom
mariaa144:docs-service-port
Closed

mariaa144 wants to merge 1 commit into
anomalyco:devfrom
mariaa144:docs-service-port

Conversation

@mariaa144

@mariaa144 mariaa144 commented Nov 8, 2026 •

Copy link
Copy Markdown

Adds a "Change the service port" section to the troubleshooting page, after "Allow a browser origin".

The service's default port is machine-global while the service configuration is per user, so on machines where several accounts run OpenCode at the same time (multi-user Windows is the common case) the second account's service cannot bind the default port and fails with "port is in use by another process" — with nothing in the docs pointing at the fix. The port and hostname service keys exist and work, but neither the troubleshooting page nor the CLI docs mention them: the documented service set examples cover only cors and disabled, and the web docs' default-port table says only "You can change this config with the opencode service command" without showing how.

The new section covers service set port / get / unset, the per-user storage and next-start semantics, the hostname sibling key, and the service set disabled true alternative for accounts that want no shared service at all. All commands verified on 2.1.1 and 2.2.6: the service binds exactly the configured port on next start, service get port prints the value, and service unset port restores the default.

Refs #62749


Added by the opencode bot (AI-generated).

Related: #62749, #50672, #56792

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Nov 8, 2026
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 72 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new section is accurate about the commands: service get, service set and service unset work as written for port and hostname, and the default port is the same for every account on a machine. I checked this against the code on dev; there was nothing to run for a docs-only change.

Public API: unchanged (docs only).

Two sentences need correcting before this is ready, both noted inline: the error message the section quotes isn't the one users see, and the disabled alternative still uses a (random) port and turns off pairing.

Optional: cli/web.mdx (Configure section) already shows service set port and service set hostname, so linking to it would keep the two pages in sync.

Related: #62749, #50672, #56792


The service's default port is the same for every user account on the machine, while the service configuration is per user. When two
accounts run OpenCode at the same time — shared Windows machines are the common case — the second account's service cannot bind the
default port and its clients fail with "port is in use by another process". Give the account its own port:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error text doesn't exist in the code. The actual message (packages/cli/src/server-process.ts:181) is:

Managed service port <port> on <host> is already in use by <process>. Configure another port with `opencode service set port <port>` and start the service again.

Please quote that wording, e.g. "Managed service port … is already in use", so users who search for the error land here.

"With no port at all" isn't accurate. With disabled set to true, each start runs a standalone server on a random free port (--port 0 in services/standalone.ts). It's also worth noting the trade-off: while the service is disabled, opencode pair (web and app pairing) refuses to run, because it needs the background service.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 72-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Nov 11, 2026
@github-actions github-actions Bot closed this Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant