anomalyco / anomalyco/opencode
opencode serve fails immediately with generic 'ServeError' on Windows, no stack trace even at DEBUG level
@Hona is already working on this.
Since Aug 17, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
opencode serve fails immediately on every attempt on Windows 11, with a generic error and zero diagnostic detail:
Warning: OPENCODE_SERVER_PASSWORD is not set; server is unsecured.
Error: Unexpected error
ServeError
opencode (interactive TUI mode) works completely fine on the same machine, same install, same config — this is isolated specifically to serve.
Environment
- OS: Windows 11 Home (build 26200)
- opencode-ai: reproduced on both 1.18.15 and 1.18.18 (latest at time of filing)
- Install:
npm install -g opencode-ai - Shell: tested from both Git Bash and PowerShell (Administrator), identical result
Steps to reproduce
opencode serve --port 4096
Fails immediately (well under a second after the config-loading log lines), no port ever binds.
What I've ruled out (extensive isolation testing)
- Not port-specific — identical failure on ports 4096, 4097, 4098, 4099, and others. None were pre-bound (confirmed via
netstatbefore each attempt). - Not a plugin issue — identical failure with
--pure(no external plugins loaded). - Not a version issue — identical failure on 1.18.15 and 1.18.18.
- Not a corrupted install — full clean
npm uninstall -g opencode-ai+npm cache clean --force+ freshnpm install -g opencode-ai@latest, still fails identically. Confirmed the fresh install works for everything else (opencode --version,opencode run "..."both succeed and return real model output). - Not config-related — identical failure with the two local config files (
opencode.json,opencode.jsonc) both temporarily removed entirely (zero custom config). - Not the local MCP entry — identical failure with the
mcpblock in config disabled. - Not hostname/binding-specific — identical failure with
--hostname 127.0.0.1(default),--hostname 0.0.0.0, and--hostname localhost. - Not verbosity-related —
--print-logs --log-level DEBUGandDEBUG=*env var both produce the exact same three-line output, no additional detail.
Expected behavior
opencode serve starts a headless server and binds the given port, same as it presumably does on other platforms / for other users, enabling API-based integrations (e.g. opencode-telegram-bot, which requires opencode serve to function and is currently completely blocked by this).
Actual behavior
Immediate failure with a generic wrapped error, no stack trace, no indication of what actually threw.
Additional context
Given the error is a clean, immediate return (not a hang or timeout), this looks like an exception being thrown and caught by the CLI's own generic error handler during server construction, with the real underlying error swallowed rather than surfaced. Happy to run additional diagnostics or a debug build if that would help narrow it down further — I've exhausted what's reachable from the public CLI surface.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.