{"record":{"id":"3b1818ff1c19b240","repo":"TencentCloud/TencentDB-Agent-Memory","slug":"tag-l2-vectorstore-unavailable-cannot-read","errorCode":null,"errorMessage":"${TAG} [L2] VectorStore unavailable — cannot read L1 memories for scene extraction (session=${sessionKey})","messagePattern":"(.+?) \\[L2\\] VectorStore unavailable — cannot read L1 memories for scene extraction \\(session=(.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"MemoryCore/src/utils/pipeline-factory.ts","lineNumber":762,"sourceCode":"      }\n\n      logger.debug?.(\n        `${TAG} [L2] Incremental query returned ${memRecords.length} record(s) (session=${sessionKey})`,\n      );\n\n      records = memRecords.map((r) => ({\n        content: r.content,\n        created_at: r.createdAt,\n        id: r.id,\n        updatedAt: r.updatedAt,\n        teamId: r.teamId,\n        userId: r.userId,\n        agentId: r.agentId,\n        sessionId: r.sessionId,\n        taskId: r.taskId,\n      }));\n    } else {\n      throw new Error(`${TAG} [L2] VectorStore unavailable — cannot read L1 memories for scene extraction (session=${sessionKey})`);\n    }\n\n    if (records.length === 0) {\n      logger.debug?.(`${TAG} [L2] No new L1 records found (session=${sessionKey}), skipping scene extraction`);\n      return;\n    }\n\n    const grouped = new Map<string, typeof records>();\n    for (const record of records) {\n      const key = buildIsolationScope(record);\n      const list = grouped.get(key) ?? [];\n      list.push(record);\n      grouped.set(key, list);\n    }\n\n    let processedTotal = 0;\n    let anyEmptyExtraction = false;\n    const l2PromptTargets = [...grouped.values()].map((groupRecords) => ({","sourceCodeStart":744,"sourceCodeEnd":780,"githubUrl":"https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/3efcd317b84146d6a08518ac0f7ee7c8a8d200ec/MemoryCore/src/utils/pipeline-factory.ts#L744-L780","documentation":"The L2 runner needs to read L1 memory records from the VectorStore to perform scene extraction. If the vector store handle is unavailable (not initialized or degraded) at that point, it throws rather than extracting scenes from an empty/incomplete view of memories, and includes the session key for diagnosis.","triggerScenarios":"createL2Runner's scene-extraction step runs for a session whose VectorStore is null/unavailable — typically pipeline init failed earlier or the store was torn down while the L2 runner still executes.","commonSituations":"L2 processing continuing after a degraded store during startup; session replay for an old session after store restart; misconfigured wiring where initStores was never awaited before the L2 runner fires.","solutions":["Ensure initStores completed successfully before creating/running the L2 runner","Re-initialize or restore the VectorStore, then retry scene extraction for the session","Check pipeline logs for an earlier degraded-mode failure (see VectorStore degraded error)","Short-circuit L2 processing when the store is unavailable instead of scheduling the runner"],"exampleFix":"// before\nconst runner = await factory.l2Runner(sessionKey); // throws if store gone\n// after\nif (!factory.hasVectorStore()) { logger.warn('skip L2: no store'); return; }\nconst runner = await factory.l2Runner(sessionKey);","handlingStrategy":"validation","validationCode":"if (!factory.hasVectorStore?.()) { logger.warn(`[L2] skipping scene extraction for ${sessionKey}: no vector store`); return; }","typeGuard":null,"tryCatchPattern":"try { await l2Runner(sessionKey); } catch (e) { if (e.message.includes('[L2] VectorStore unavailable')) { logger.warn(`L2 deferred for ${sessionKey}: store unavailable`); await requeueLater(sessionKey); } else throw e; }","preventionTips":["Initialize stores before scheduling any L2 work","Requeue L2 sessions whose store was unavailable instead of failing them permanently","Tear down L2 runners when the vector store is shut down"],"tags":["vector-store","l2","session-processing"],"backgroundTag":"vector-store-unavailable","analyzedSha":"3efcd317b84146d6a08518ac0f7ee7c8a8d200ec","analyzedAt":"2026-09-01T05:44:22.276Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}