{"record":{"id":"4e2460ac0e875917","repo":"deepseek-ai/deepseek-harness","slug":"session-sessionid-already-exists","errorCode":null,"errorMessage":"session \"${sessionId}\" already exists","messagePattern":"session \"(.+?)\" already exists","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/session/src/index.ts","lineNumber":871,"sourceCode":"   * @param options - seed events and/or creation metadata for the header. With\n   *   `seedSource: 'persistence'`, metadata and events must be fresh detached\n   *   graphs whose ownership transfers to this call: they are validated and\n   *   frozen in place through {@link Session.fromRestore}, so the caller must\n   *   retain no mutable aliases.\n   * @returns the constructed session, NOT yet in the store.\n   * @throws if a session with `id` already exists, metadata is not a plain\n   *   lossless-JSON record with valid scalar fields, or `meta.cwd` is a\n   *   non-absolute path.\n   */\n  prepare(id?: SessionId, options?: PrepareSessionOptions): Session {\n    let sessionId: SessionId\n    if (id === undefined) {\n      do sessionId = SessionId(`session-${++this.counter}`)\n      while (this.store.has(sessionId))\n    } else {\n      sessionId = SessionId(id)\n    }\n    if (this.store.has(sessionId)) throw new Error(`session \"${sessionId}\" already exists`)\n    if (options?.seedSource === 'persistence') {\n      return Session.fromRestore(sessionId, options.seed, options.meta)\n    }\n    const seed = options?.seed\n    const meta = options?.meta\n    const header: SessionHeader = {\n      version: SESSION_FORMAT_VERSION,\n      id: sessionId,\n      createdAt: meta?.createdAt ?? Date.now(),\n      ...meta?.cwd === undefined ? {} : { cwd: meta.cwd },\n      ...meta?.parentSession === undefined ? {} : { parentSession: meta.parentSession },\n      ...meta?.seedLength === undefined ? {} : { seedLength: meta.seedLength },\n      ...meta?.origin === undefined ? {} : { origin: meta.origin },\n      ...meta?.delegationDepth === undefined ? {} : { delegationDepth: meta.delegationDepth },\n      ...meta?.agentPreset === undefined ? {} : { agentPreset: meta.agentPreset },\n    }\n    return Session.create(sessionId, seed, header)\n  }","sourceCodeStart":853,"sourceCodeEnd":889,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/core/session/src/index.ts#L853-L889","documentation":"Error \"session \"${sessionId}\" already exists\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/core/session/src/index.ts:871 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"}