{"record":{"id":"27be628a063e3e7f","repo":"deepseek-ai/deepseek-harness","slug":"session-id-is-already-attached-to-a-store","errorCode":null,"errorMessage":"session \"${id}\" is already attached to a store","messagePattern":"session \"(.+?)\" is already attached to a store","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/session/src/index.ts","lineNumber":919,"sourceCode":"   * another create) between them, so a stale prepared session must NOT overwrite\n   * a live store entry of the same id — its detach disposer would later delete\n   * the REAL session. The {@link create} convenience and the agent factory call\n   * the two back-to-back so they never trip this, but the public API cannot\n   * assume that.\n   *\n   * @param session - a {@link prepare}d session not yet in the store.\n   * @returns the detach disposer (publication hooks + store removal). When called from\n   *   a synchronous `session/created` listener, removal and disposal wait until\n   *   that creation dispatch unwinds.\n   * @throws if a session with this id is already in the store.\n   */\n  enter(session: Session): () => void {\n    const id = session.id\n    const carrier = scopeTarget(session, scopeOf(this.ctx))\n    // This is the authoritative collision boundary after arbitrary unpublished\n    // preparation. Only one exact same-id transaction can publish.\n    if (this.store.has(id)) throw new Error(`session \"${id}\" already exists`)\n    if (attachments.has(session)) throw new Error(`session \"${id}\" is already attached to a store`)\n    const entry: SessionEntry = {\n      id,\n      session,\n      carrier,\n      emitCtx: this.ctx,\n      announced: false,\n      announcing: false,\n      appending: false,\n      detachRequested: false,\n      detach: () => { this.detachEntered(entry) },\n    }\n    this.store.set(id, entry)\n    attachments.set(session, entry)\n    let entered = true\n    const detach = (): void => {\n      if (!entered) return\n      entered = false\n      // A lifecycle listener may own the advanced detach capability. Keep the","sourceCodeStart":901,"sourceCodeEnd":937,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/core/session/src/index.ts#L901-L937","documentation":"Error \"session \"${id}\" is already attached to a store\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/core/session/src/index.ts:919 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"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"}