{"record":{"id":"bab97fd835b0128d","repo":"can1357/oh-my-pi","slug":"unsupported-acp-session-sessionid","errorCode":null,"errorMessage":"Unsupported ACP session: ${sessionId}","messagePattern":"Unsupported ACP session: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/modes/acp/acp-agent.ts","lineNumber":1379,"sourceCode":"\tasync #handleLifetimeEvent(record: ManagedSessionRecord, event: AgentSessionEvent): Promise<void> {\n\t\tif (event.type !== \"thinking_level_changed\" && event.type !== \"model_changed\") {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tawait this.#pushConfigOptionUpdate(record);\n\t\t} catch (error) {\n\t\t\tlogger.warn(\"Failed to push config_option_update after a lifetime event\", {\n\t\t\t\tsessionId: record.session.sessionId,\n\t\t\t\teventType: event.type,\n\t\t\t\terror,\n\t\t\t});\n\t\t}\n\t}\n\n\t#getSessionRecord(sessionId: string): ManagedSessionRecord {\n\t\tconst record = this.#sessions.get(sessionId);\n\t\tif (!record) {\n\t\t\tthrow new Error(`Unsupported ACP session: ${sessionId}`);\n\t\t}\n\t\treturn record;\n\t}\n\n\t#assertMatchingCwd(session: AgentSession, cwd: string): void {\n\t\tconst expected = path.resolve(cwd);\n\t\tconst actual = path.resolve(session.sessionManager.getCwd());\n\t\tif (actual !== expected) {\n\t\t\tthrow new Error(`ACP session ${session.sessionId} is already loaded for ${actual}, not ${expected}`);\n\t\t}\n\t}\n\n\tasync #resolveForkSourceSessionPath(sessionId: string): Promise<string> {\n\t\tconst loaded = this.#sessions.get(sessionId);\n\t\tif (loaded) {\n\t\t\tif (isPromptTurnInFlight(loaded.promptTurn)) {\n\t\t\t\tthrow new Error(`ACP session fork is unavailable while a prompt is in progress: ${sessionId}`);\n\t\t\t}","sourceCodeStart":1361,"sourceCodeEnd":1397,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/modes/acp/acp-agent.ts#L1361-L1397","documentation":"Thrown by #getSessionRecord when an ACP request references a sessionId that is not present in the agent's in-memory session map. The agent only knows sessions it created or loaded in this process; a record lookup is required by most session-scoped requests (prompt, cancel, model set, etc.).","triggerScenarios":"Any session-scoped ACP call (prompt, cancel, set_session_model, set_session_mode, fork, etc.) with an id that was never established in this ACP connection or that has since been disposed/unloaded.","commonSituations":"Client reconnects and reuses stale session ids from a previous agent process; the session was closed/unloaded server-side; a typo'd or foreign session id from another client; agent restarted between calls.","solutions":["List available sessions (session/list) and use a valid, current sessionId.","Create or load the session first (session/new or session/load) before sending session-scoped requests.","If the client restarted, re-initialize and re-load prior sessions rather than reusing cached ids."],"exampleFix":"// before\nawait conn.prompt({ sessionId: rememberedId, prompt });\n// after\nconst sessions = await conn.list();\nconst live = sessions.find(s => s.id === rememberedId);\nif (!live) rememberedId = (await conn.new({ cwd })).sessionId;\nawait conn.prompt({ sessionId: rememberedId, prompt });","handlingStrategy":"validation","validationCode":"// verify the session is known before any session-scoped call\nconst known = typeof listSessions === \"function\" ? (await listSessions()).some(s => s.id === sessionId) : undefined;\nif (!known) throw new Error(`session ${sessionId} not established; call session/new or session/load first`);","typeGuard":null,"tryCatchPattern":"try {\n  await conn.prompt({ sessionId, prompt });\n} catch (err) {\n  if (err.message.startsWith(\"Unsupported ACP session:\")) {\n    const created = await conn.new({ cwd });\n    sessionId = created.sessionId;\n  } else throw err;\n}","preventionTips":["Track session ids returned by session/new or session/load; never reuse ids across agent restarts.","Refresh cached session ids via session/list after reconnects.","Dispose/forget client-side state when a session is unloaded."],"tags":["acp","session-management","invalid-state"],"backgroundTag":"unknown-session-id","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}