{"record":{"id":"3d5a0f032d9d00d2","repo":"deepseek-ai/deepseek-harness","slug":"session-agent-was-disposed-outside-the-server-p","errorCode":null,"errorMessage":"session agent was disposed outside the server: ${params.sessionId}","messagePattern":"session agent was disposed outside the server: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/sdk/server/src/server.ts","lineNumber":138,"sourceCode":"    if (!this.hasAdapterFor(this.provider)) {\n      if (this.provider !== 'deepseek-official') throw new Error(`no adapter registered for provider \"${this.provider}\"`)\n      this.llmFiber = await this.ctx.plugin(LlmDeepSeek, {})\n    }\n    return { serverInfo: { name: 'deepseek-harness-sdk-runtime', version: '0.0.1' } }\n  }\n\n  /**\n   * Queue one identified prompt without assigning later activity to it.\n   * @param params - target session and user content.\n   * @returns the durable message identity.\n   */\n  async prompt(params: SessionPromptParams): Promise<SessionPromptResult> {\n    const rec = await this.getOrCreateSession(params.sessionId)\n    // An agent-loop-only reload disposes the loop's agents while this record\n    // survives; a retained agent accepts followup() silently, so validate the\n    // record against the live registry before delivery (as the ACP bridge does).\n    if (this.ctx.agents.get(rec.handle.agent.id) !== rec.handle.agent) {\n      throw new Error(`session agent was disposed outside the server: ${params.sessionId}`)\n    }\n    const message = createUserMessage({ content: params.contentBlocks, source: { kind: 'user' } })\n    rec.handle.agent.followup(message)\n    return { messageId: message.id }\n  }\n\n  /**\n   * Dispose server-owned agents, adapter, and subscriptions to quiescence.\n   * The surrounding context remains running.\n   * @returns empty JSON-RPC result.\n   */\n  shutdown(): Promise<Record<string, never>> {\n    this.shutdownTask ??= this.performShutdown()\n    return this.shutdownTask\n  }\n\n  private async performShutdown(): Promise<Record<string, never>> {\n    this.shuttingDown = true","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/sdk/server/src/server.ts#L120-L156","documentation":"Error \"session agent was disposed outside the server: ${params.sessionId}\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/sdk/server/src/server.ts:138 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Do not dispose the session agent directly; close sessions through the SDK server API."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}