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
I followed the steps to set this up pretty simply, but it seems to give me an error when I try to connect. I can post sanitized logs later, but I'm doing this from my phone so it's not easy.
My first thought was maybe it's because I have OpenCode 2 set up, and I didn't see any mention of it in other issues.
Thanks!
Reacted by José Ignacio Amelivia Santiago and wanly
I reproduced this with OpenCode Mobile 0.4.15 on Android against the OpenCode 2 preview (opencode2 v0.0.0-beta-19296) over Tailscale. The network path itself is working.
Server command:
opencode2 serve --hostname 0.0.0.0 --port 4096
The OpenCode 2 process is confirmed listening on 0.0.0.0:4096. With valid Basic Auth credentials:
GET /global/health
HTTP/1.1 200 OK
content-type: text/html
That route falls through to the OpenCode web SPA (<!doctype html>...), so OpenCode Mobile reports HEALTH-FAILED because it probes /global/health.
However:
GET /api/health
HTTP/1.1 200 OK
content-type: application/json
{"healthy":true,"version":"0.0.0-beta-19296","pid":44736}
So at least the initial connection failure appears to be an OpenCode 1 vs OpenCode 2 API compatibility issue, not Tailscale/firewall/authentication. I haven't established yet whether changing the health probe alone is sufficient; the session/message/event endpoints may also differ in v2.
Android diagnostic details: Pixel 10 Pro, Android 37, OpenCode Mobile 0.4.15. Tailscale server address was reachable and the OpenCode 2 /api/health endpoint was verified from the host.
Reacted by José Ignacio Amelivia Santiago, Eitho, 乌洛斯如是说, dsensy and Solo_mag
v2 server support is implemented in #209 — the app now probes the server at connect time (by response content type, since unknown routes on both server generations answer 200 text/html through the web SPA) and speaks whichever API the server does.
The connection error you hit is the old client talking v2 routes that fall through to the SPA — that is exactly what #209 fixes, for v2 and keeps v1 (≤ 1.18.x, still what npm install -g opencode-ai installs) working. Would appreciate a test if you get a chance once it lands (or from the bluetoe-99:feat/opencode-v2 branch).
As I was eager to get v2 support, I ended up building the APK from the fork manually, and I can confirm that everything works. Please merge the PR and publish an update as soon as possible.
Another data point in favor of merging #209: reproduced against the stable release line, not just the preview.
Server: opencode serve --hostname 0.0.0.0 --port 4096, version 2.0.26 (auto-updated from 2.0.18), behind a reverse proxy with TLS.
OpenCode Mobile 0.4.15 (Play) — connection diagnostics report OK (health endpoint responds), but the app then fails to list sessions: it calls the v1 routes (/session, /experimental/session) which the v2 server answers with 200 text/html (SPA fallback), so there is nothing to parse.
With the v2 routes the same server is fine: GET /api/session → 401 without auth, 200 JSON with Basic auth.
From the app source (v0.4.15/current main) I see no /api/* routes at all, so this is purely v1-only. Happy to test an APK from the bluetoe-99:feat/opencode-v2 branch against 2.0.26 if that helps.
Same issue here, with details that may help narrow it down:
App: v0.4.15 (fdroid build), Android (HarmonyOS NEXT via Android compat layer)
Server: opencode Desktop 2.0.29 background service, reached via HTTPS tunnel
The in-app connection diagnostic passes (health endpoint 200, server root 200)
But login with correct Basic-auth credentials (verified working via curl: HTTP 200 on /api/info) fails in the app
Server-side logs show no auth failures at all, so the app seems to fail before/without completing the V2 handshake
This looks like the V1/V2 protocol gap tracked in #209 rather than a credentials problem.
Also related: #211 (the diagnostic misleadingly reports password errors).
Happy to test a V2-support build when one is available.
Confirmed on current builds — the app (v0.4.15, Android) fails against any OpenCode v2 server I can obtain (desktop background service v2.1.2, then v2.1.3 after the desktop auto-update, Windows):
Manual Add Connection (IP + port + password): Connection Failed — Error: JSON Parse error: Unexpected character: <. The app's diag shows "OK 200" for /global/health — it appears to check only the HTTP status, while v2 serves the web SPA shell there (200 text/html) on all non-/api/*//auth/* paths.
Pasting a one-time pair link (opencode pair → http://<LAN-IP>:<port>/auth/connect/<code>) into the server-address field: asks for the password → 401 despite correct credentials → "404 api error".
/api/health existed in server v2.1.2 (auth-gated, 401 application/json unauthenticated) and was removed in v2.1.3 (404) — worth knowing if any probe still references it.
Content-type observations from the OpenCode team's angle:
GET /global/health on v2: 200 text/html on all server builds tested.
The OpenCode team confirmed the app targets the v1 HTTP API (/global/health returned JSON in v1, and everything outside /api/*//auth/* falls through to the SPA) — see anomalyco/opencode#58145
The browser workaround works well today: opencode pair → open the LAN link in the phone's browser → full v2 web UI, 30-day session. Really hoping #209 or #218 lands so the app itself can speak v2!
Closing as completed — verified 2026-11-14: OpenCode v2 server support shipped in v0.4.16, commit 66ad0da ('feat: OpenCode v2 server support (v0.4.16)'), an ancestor of both the v0.4.16 and v0.4.17 tags. The v0.4.16 changelog (distribution/changelogs/43.txt) states v2 servers are now supported with connect-time API detection, and main carries src/lib/api-detect.ts + src/lib/v2-shape.ts (with tests) while v1 servers keep working through the legacy client. The original PR #209 closed unmerged — the work landed as direct commit 66ad0da. If you still hit a connection failure on v0.4.16+, please open a new issue with the app version and server version.
Activity
curleyscreek commentedon Sep 13, 2026
I reproduced this with OpenCode Mobile 0.4.15 on Android against the OpenCode 2 preview (
opencode2 v0.0.0-beta-19296) over Tailscale. The network path itself is working.Server command:
The OpenCode 2 process is confirmed listening on
0.0.0.0:4096. With valid Basic Auth credentials:That route falls through to the OpenCode web SPA (
<!doctype html>...), so OpenCode Mobile reportsHEALTH-FAILEDbecause it probes/global/health.However:
So at least the initial connection failure appears to be an OpenCode 1 vs OpenCode 2 API compatibility issue, not Tailscale/firewall/authentication. I haven't established yet whether changing the health probe alone is sufficient; the session/message/event endpoints may also differ in v2.
Android diagnostic details: Pixel 10 Pro, Android 37, OpenCode Mobile 0.4.15. Tailscale server address was reachable and the OpenCode 2
/api/healthendpoint was verified from the host.bluetoe-99 commentedon Sep 25, 2026
v2 server support is implemented in #209 — the app now probes the server at connect time (by response content type, since unknown routes on both server generations answer
200 text/htmlthrough the web SPA) and speaks whichever API the server does.The connection error you hit is the old client talking v2 routes that fall through to the SPA — that is exactly what #209 fixes, for v2 and keeps v1 (≤ 1.18.x, still what
npm install -g opencode-aiinstalls) working. Would appreciate a test if you get a chance once it lands (or from thebluetoe-99:feat/opencode-v2branch).wanlyg commentedon Oct 2, 2026
Awesome app! Please consider adding support for OpenCode v2.
Solomag commentedon Oct 6, 2026
As I was eager to get v2 support, I ended up building the APK from the fork manually, and I can confirm that everything works. Please merge the PR and publish an update as soon as possible.
blancqua commentedon Oct 11, 2026
Another data point in favor of merging #209: reproduced against the stable release line, not just the preview.
opencode serve --hostname 0.0.0.0 --port 4096, version 2.0.26 (auto-updated from 2.0.18), behind a reverse proxy with TLS./session,/experimental/session) which the v2 server answers with200 text/html(SPA fallback), so there is nothing to parse.GET /api/session→ 401 without auth, 200 JSON with Basic auth.From the app source (v0.4.15/current main) I see no
/api/*routes at all, so this is purely v1-only. Happy to test an APK from thebluetoe-99:feat/opencode-v2branch against 2.0.26 if that helps.wc4440222 commentedon Oct 14, 2026
Same issue here, with details that may help narrow it down:
/api/info) fails in the appThis looks like the V1/V2 protocol gap tracked in #209 rather than a credentials problem.
Also related: #211 (the diagnostic misleadingly reports password errors).
Happy to test a V2-support build when one is available.
guteseele20-design commentedon Oct 23, 2026
Confirmed on current builds — the app (v0.4.15, Android) fails against any OpenCode v2 server I can obtain (desktop background service v2.1.2, then v2.1.3 after the desktop auto-update, Windows):
Connection Failed — Error: JSON Parse error: Unexpected character: <. The app's diag shows "OK 200" for/global/health— it appears to check only the HTTP status, while v2 serves the web SPA shell there (200text/html) on all non-/api/*//auth/*paths.opencode pair→http://<LAN-IP>:<port>/auth/connect/<code>) into the server-address field: asks for the password → 401 despite correct credentials → "404 api error"./api/healthexisted in server v2.1.2 (auth-gated, 401application/jsonunauthenticated) and was removed in v2.1.3 (404) — worth knowing if any probe still references it.Content-type observations from the OpenCode team's angle:
GET /api/infoon v2: 200application/json(with Basic auth), 401application/jsonwithout → content-type-based detection (as done in feat: opencode v2 server support with v1 compatibility #209) works correctly on v2.GET /global/healthon v2: 200text/htmlon all server builds tested.The OpenCode team confirmed the app targets the v1 HTTP API (
/global/healthreturned JSON in v1, and everything outside/api/*//auth/*falls through to the SPA) — see anomalyco/opencode#58145The browser workaround works well today:
opencode pair→ open the LAN link in the phone's browser → full v2 web UI, 30-day session. Really hoping #209 or #218 lands so the app itself can speak v2!docs: add plan.md — Goal, KPIs, and plan to reach it (Oct 26, 2026)
dzianisv commentedon Nov 14, 2026
Closing as completed — verified 2026-11-14: OpenCode v2 server support shipped in v0.4.16, commit 66ad0da ('feat: OpenCode v2 server support (v0.4.16)'), an ancestor of both the v0.4.16 and v0.4.17 tags. The v0.4.16 changelog (distribution/changelogs/43.txt) states v2 servers are now supported with connect-time API detection, and main carries src/lib/api-detect.ts + src/lib/v2-shape.ts (with tests) while v1 servers keep working through the legacy client. The original PR #209 closed unmerged — the work landed as direct commit 66ad0da. If you still hit a connection failure on v0.4.16+, please open a new issue with the app version and server version.