[Bug]: opencode provider fails at startSession — opencode.mcp.add returns 500 UnknownError
Before submitting
Area
apps/server (opencode provider adapter)
Steps to reproduce
- T3 service running on Linux (Orange Pi 5, systemd user service), provider = local OpenCode 1.18.29.
~/.config/opencode/opencode.jsonc has 5 Cloudflare remote MCPs enabled (4 of them in needs_auth, only cloudflare-docs connected).
- Open any thread with the OpenCode provider and send a prompt.
- Turn fails immediately with the error below.
Expected behavior
Session starts; T3 registers its MCP endpoint on the OpenCode server.
Actual behavior
ProviderAdapterProcessError: Provider adapter process error (opencode) for thread 53e10d8c-c496-448b-8f7d-8b7872317be4: Unexpected server error. Check server logs for details.
...
[cause]: Error: {"body":{"name":"UnknownError","data":{"message":"Unexpected server error. Check server logs for details.","ref":"err_90bd82fd"}},"status":500}
Trace chain (server.trace.ndjson, trace 979074f06a4e769ff881a415b253c991, 2026-09-07T09:00:59Z):
McpSessionRegistry.issue Success → opencode.global.health Success →
verifyOpenCodeServerVersion Success → opencode.mcp.add Failure (500, ref err_90bd82fd) →
startSession Failure → ensureSessionForThread Failure.
Notably the OpenCode server log (~/.local/share/opencode/log/opencode.log) contains
no ERROR line at 09:00:59Z for this request — the 500 is silent server-side
(the only err_90bd82fd matches anywhere are T3's own trace lines).
Side effects of the never-started session:
ProviderService.stopSession: Cannot route thread ... because no persisted provider binding exists.
ThreadSettlementReactor: settlement skipped for the thread.
Version / Environment
t3 v0.0.38 (service), also present on 0.0.39 changelog check: no mcp.add fix listed
opencode 1.18.29 (/home/sunsilk/.opencode/bin/opencode, satisfies >=1.14.19)
- Linux ARM64 (Orange Pi 5 Max), Node v26.5.0, systemd user service
- Model in other sessions:
opencode / muse-spark-1.3-contributor-free
(free-tier rate_limit_exceeded also observed same day in unrelated sessions)
Logs
Attached / available on request:
trace-thread-53e10d8c.jsonl — all T3 trace spans mentioning the thread (73 lines)
trace-turn-failure.jsonl — the 9-span failure chain for the turn
opencode-log-0900-UTC.txt — OpenCode server log slice around the failure
opencode.jsonc — MCP config (5 Cloudflare remote MCPs)
- Full stacks redacted to the two
at frames above; complete traces in the files.
Root cause (confirmed 2026-09-07, opencode 1.18.29 source + local DB)
Project.migrateProjectId (packages/opencode/src/project/project.ts) runs
UPDATE workspace SET project_id=..., but the local
~/.local/share/opencode/opencode.db still has the ancient
workspace(id, provider, binding, created_at, last_used_at) shape — no
project_id column — even though migration 20260808023530_workspace_domain
is recorded as applied. Every Project.fromDirectory(/home/sunsilk/infra)
therefore throws SQLiteError: no such column: project_id
(opencode.log refs err_1cc751ba, err_48f24f83, err_db9fd44c,
err_cfd939de), and T3's opencode.mcp.add surfaces it as 500
UnknownError (err_90bd82fd, then err_e76414f8 on t3 0.0.39).
Likely trigger: git remote add origin in ~/infra changed the computed
project ID, activating the previous → new migration path.
Verified fixed locally by ALTER TABLE workspace ADD COLUMN project_id TEXT
(backup: opencode.db.bak in this folder) + POST /session for
/home/sunsilk/infra returning a live session. Upstream issue belongs to
sst/opencode (migration recorded-but-not-applied / missing-column guard),
with a T3-side hardening ask below.
Suspected cause / questions
Does T3's mcp.add payload conflict... → answered: no, it's the workspace schema mismatch (above).
- Should a failing T3 MCP registration fail the whole
startSession, or degrade (session without T3 tools) with a warning?
- Should a failing T3 MCP registration fail the whole
startSession, or degrade (session without T3 tools) with a warning?
- OpenCode returns
UnknownError 500 with a ref but logs nothing — may need an upstream sst/opencode report with the ref.
Workaround tried
Restarting the T3 service; error persists per-thread on new turns.
[Bug]: opencode provider fails at startSession —
opencode.mcp.addreturns 500 UnknownErrorBefore submitting
ProviderAdapterProcessError+ opencode hits are OpenCode adapter requiresprovider/model, but OpenCode Go runtime rejectsopencode-go/<model>and expects bare model id #3571 model-id, Codex provider fails on SSH remote: Missing key at ["thread"]["sessionId"] in thread/start response #2668 codex, [Bug]: Nightly - OpenCode provider false "not installed / not on PATH" on Windows #2163 windows PATH, [Bug]: Connecting to a remote OpenCode server through URL running on Linux from a Windows machine does not work #3094 remote URL — none ismcp.add500).Area
apps/server (opencode provider adapter)
Steps to reproduce
~/.config/opencode/opencode.jsonchas 5 Cloudflare remote MCPs enabled (4 of them inneeds_auth, onlycloudflare-docsconnected).Expected behavior
Session starts; T3 registers its MCP endpoint on the OpenCode server.
Actual behavior
Trace chain (
server.trace.ndjson, trace979074f06a4e769ff881a415b253c991, 2026-09-07T09:00:59Z):McpSessionRegistry.issueSuccess →opencode.global.healthSuccess →verifyOpenCodeServerVersionSuccess →opencode.mcp.addFailure (500, referr_90bd82fd) →startSessionFailure →ensureSessionForThreadFailure.Notably the OpenCode server log (
~/.local/share/opencode/log/opencode.log) containsno ERROR line at 09:00:59Z for this request — the 500 is silent server-side
(the only
err_90bd82fdmatches anywhere are T3's own trace lines).Side effects of the never-started session:
ProviderService.stopSession:Cannot route thread ... because no persisted provider binding exists.ThreadSettlementReactor: settlement skipped for the thread.Version / Environment
t3 v0.0.38(service), also present on0.0.39changelog check: nomcp.addfix listedopencode 1.18.29(/home/sunsilk/.opencode/bin/opencode, satisfies >=1.14.19)opencode / muse-spark-1.3-contributor-free(free-tier
rate_limit_exceededalso observed same day in unrelated sessions)Logs
Attached / available on request:
trace-thread-53e10d8c.jsonl— all T3 trace spans mentioning the thread (73 lines)trace-turn-failure.jsonl— the 9-span failure chain for the turnopencode-log-0900-UTC.txt— OpenCode server log slice around the failureopencode.jsonc— MCP config (5 Cloudflare remote MCPs)atframes above; complete traces in the files.Root cause (confirmed 2026-09-07, opencode 1.18.29 source + local DB)
Project.migrateProjectId(packages/opencode/src/project/project.ts) runsUPDATE workspace SET project_id=..., but the local~/.local/share/opencode/opencode.dbstill has the ancientworkspace(id, provider, binding, created_at, last_used_at)shape — noproject_idcolumn — even though migration20260808023530_workspace_domainis recorded as applied. Every
Project.fromDirectory(/home/sunsilk/infra)therefore throws
SQLiteError: no such column: project_id(opencode.log refs
err_1cc751ba,err_48f24f83,err_db9fd44c,err_cfd939de), and T3'sopencode.mcp.addsurfaces it as 500UnknownError(err_90bd82fd, thenerr_e76414f8on t3 0.0.39).Likely trigger:
git remote add originin~/infrachanged the computedproject ID, activating the
previous → newmigration path.Verified fixed locally by
ALTER TABLE workspace ADD COLUMN project_id TEXT(backup:
opencode.db.bakin this folder) +POST /sessionfor/home/sunsilk/infrareturning a live session. Upstream issue belongs tosst/opencode(migration recorded-but-not-applied / missing-column guard),with a T3-side hardening ask below.
Suspected cause / questions
Does T3's→ answered: no, it's the workspace schema mismatch (above).mcp.addpayload conflict...startSession, or degrade (session without T3 tools) with a warning?startSession, or degrade (session without T3 tools) with a warning?UnknownError500 with a ref but logs nothing — may need an upstreamsst/opencodereport with the ref.Workaround tried
Restarting the T3 service; error persists per-thread on new turns.