Repository navigation
Description
Summary
The desktop app periodically (observed every ~20 minutes, as two interleaved cadences ~2 minutes apart) issues GET /api/session/<id> for session IDs that never existed in the server's store, receives 404 SessionNotFoundError, and surfaces a modal error (请求失败 / Session not found: ses_…). Impact: recurring modal interruption while working; no data loss observed.
Environment
- opencode version: 2.0.32 (desktop
@opencodedesktop2.0.32.0, staged CLI 2.0.32, npm global@opencode/[email protected]) - OS: Windows 11, 10.0.26200.9711 (win32 x64)
- Terminal: Desktop app (Electron) — not applicable
- Shell:
C:\WINDOWS\system32\cmd.exe(PowerShell 5.1.26100.9711) - Install/channel: latest; background service at
http://127.0.0.1:45278 - Active plugins:
opencode-feishu-plugin0.2.30 (from~/.config/opencode/opencode.json), local TUI pluginplugins/tui-tps(fromcli.json)
Reproduction
- Start the desktop app connected to the local background service, with at least one real session open (a TUI/CLI client was also connected on the same machine).
- Leave it running idle; no user interaction is required.
- Within ~20 minutes a modal appears:
请求失败 / Session not found: ses_<id>; it recurs on a ~20-minute cadence. Two interleaved series were observed, e.g. at:49:53 / :09:53and:51:52 / :11:52(server log clock). - The same second, the server log shows (verbatim):
timestamp=2026-10-19T08:09:53.912Z level=INFO run=80c266f5 message="Sent HTTP response" http.span=2 role=server http.method=GET http.url=/api/session/ses_eacca402fffeN7u3VJ0c4Amhrr http.status=404
timestamp=2026-10-19T08:09:53.914Z level=INFO run=80c266f5 message="Sent HTTP response" http.span=1 role=server http.method=GET http.url=/api/session/ses_eacca402fffeN7u3VJ0c4Amhrr http.status=404
timestamp=2026-10-19T08:09:53.916Z level=INFO run=80c266f5 message="Sent HTTP response" http.span=1 role=server http.method=GET http.url=/api/session/ses_eacca402fffeN7u3VJ0c4Amhrr http.status=404
timestamp=2026-10-19T08:09:54.364Z level=INFO run=80c266f5 message="Sent HTTP response" http.span=1 role=server http.method=GET http.url=/api/session/ses_eacca402fffeN7u3VJ0c4Amhrr http.status=404
timestamp=2026-10-19T08:11:52.684Z level=INFO run=80c266f5 message="Sent HTTP response" http.span=3 role=server http.method=GET http.url=/api/session/ses_eacc87069ffeJISQHT2U1BD7oA http.status=404
timestamp=2026-10-19T08:11:52.695Z level=INFO run=80c266f5 message="Sent HTTP response" http.span=3 role=server http.method=GET http.url=/api/session/ses_eacc87069ffeJISQHT2U1BD7oA http.status=404
Response body (retrieved from the desktop renderer's Chromium HTTP cache):
{"_tag":"SessionNotFoundError","sessionID":"ses_eae1dfbb5ffe69zYeau2G1dAkc","message":"Session not found: ses_eae1dfbb5ffe69zYeau2G1dAkc"}Expected Behavior
No modal error for internal/ephemeral session IDs. Either the request should not be issued, or a 404 for a session the UI itself did not create should be handled silently (e.g. dropped from the tab/list) instead of raising a modal dialog.
Actual Behavior
A modal error 请求失败 / Session not found: ses_… with a dismiss (×) button, recurring roughly every 20 minutes for the duration of the app session.
Additional Context
The requested IDs never existed server-side. I queried every table and text column of the live opencode.db (25 tables) plus the migration backup of the same DB — 0 rows for each offending ID. They appear only in session transcripts (self-reference from discussion of the bug). Session rows increased normally across the same period (240 → 245), so this is not lost data.
The list endpoint is healthy. GET /api/session?limit=5000&order=desc&parentID=null returns 191 sessions and each one fetches fine individually — so it is not a "list contains unreadable rows" problem.
The desktop renderer is the requester (at least for one series): the 404 responses are cached under %APPDATA%\ai.opencode.desktop\Cache\Cache_Data\data_1 for URLs http://127.0.0.1:45278/api/session/ses_….
The desktop app's own persisted UI state does not contain these IDs: drafts.sqlite (state.tabs, tabs.closed, tabs.recent, and per-session documents) and the Local Storage leveldb only reference real, existing sessions. So the IDs are not restored from local state.
Hypothesis (unconfirmed): a temporary/ephemeral session is created and then deleted quickly, and a UI component races the deletion. For example, the installed Feishu plugin implements:
const created = await doFetch(`${base}/api/session`, { method: "POST", ... })
const tempID = extractSessionID(await created.json())
try { await doFetch(`${base}/api/session/${tempID}/generate`, { method: "POST", ... }) }
finally { await doFetch(`${base}/api/session/${tempID}`, { method: "DELETE" }) }Any client that reacts to the corresponding session.created event by fetching session details will hit 404 after the DELETE. I could not confirm which component creates the sessions in this case (the plugin's summary path ran only 7 times overall, mostly a day earlier, so it does not match the 20-minute cadence).
Workarounds tried, none helped: closing/restarting the desktop app; restarting the background service; clearing the app's HTTP cache; removing a stale draft tab from drafts.sqlite; disabling an unrelated plugin watchdog.
Frequency: consistent (~every 20 min) while the app is open.
Note: the machine clock jumped by ~5 hours during the investigation, so wall-clock times above should be read from the server log's UTC timestamps.
Activity
opencode-agent commentedon Oct 19, 2026
Thanks for the detailed report and logs. I reproduced what looks like the cause.
The desktop app can't run in our sandbox, so I tested the client data layer it uses (
createDatainpackages/client) againstopencode serve2.0.32:POST /api/session, thenDELETEit right away. This is the same pattern your Feishu plugin uses for temporary sessions.session.createdevent and fetches the new session withGET /api/session/<id>. By then the session is gone, so the request returns 404Session not found: ses_…, and the error goes to the client's error handler. In the desktop app, that handler shows the "Request failed" toast you see. The server log has the sameGET /api/session/ses_… 404lines as yours.It still happens on the latest
dev(ba06ff9). The script below reproduces it.So any session that is created and then deleted quickly can trigger the modal, whatever creates it. I couldn't tell which component creates sessions every ~20 minutes on your machine, but your guess about short-lived sessions matches what I saw.
Related: #48012 (session-not-found errors are only detected in one shape) and #51940 (missing sessions are not handled when deleting).
Reproduction script (repro-57026.ts)
Run it:
bun repro-57026.tszr988888 commentedon Oct 30, 2026
Cross-platform datapoint + one extra trigger, on macOS desktop 2.2.1 with a shared background
opencode serve.GET /api/session/<id>→ canonical{"_tag":"SessionNotFoundError",...}for ids that don't exist server-side, recurring as a "Session not found" notification. Not Windows-only.