{"record":{"id":"04ac3a2a91774c8d","repo":"thedotmack/claude-mem","slug":"prompt-watermark-bump-skipped-write-failed","errorCode":null,"errorMessage":"Prompt watermark bump skipped — write failed","messagePattern":"Prompt watermark bump skipped — write failed","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/services/sync/ChromaSync.ts","lineNumber":580,"sourceCode":"      created_at_epoch: createdAtEpoch,\n      memory_session_id: memorySessionId,\n      project: project,\n      platform_source: normalizePlatformSource(platformSource)\n    };\n\n    const document = this.formatUserPromptDoc(stored);\n\n    logger.info('CHROMA_SYNC', 'Syncing user prompt', {\n      promptId,\n      project\n    });\n\n    // Only bump on a confirmed full write — see syncObservation() for rationale.\n    const written = await this.addDocuments([document]);\n    if (written === 1) {\n      ChromaSyncState.bump(project, 'prompts', promptId);\n    } else {\n      logger.warn('CHROMA_SYNC', 'Prompt watermark bump skipped — write failed', {\n        promptId,\n        project,\n        written\n      });\n    }\n  }\n\n  private mergeRowsById<T extends { id: number }>(rows: T[], pendingRows: T[]): T[] {\n    const merged = new Map<number, T>();\n    for (const row of rows) {\n      merged.set(row.id, row);\n    }\n    for (const row of pendingRows) {\n      merged.set(row.id, row);\n    }\n    return [...merged.values()].sort((a, b) => a.id - b.id);\n  }\n","sourceCodeStart":562,"sourceCodeEnd":598,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/e2d1df569a8f04075d40e92461128ece7cf04c82/src/services/sync/ChromaSync.ts#L562-L598","documentation":"syncUserPrompt writes a single formatted prompt document and bumps the prompts watermark only when addDocuments returns 1. A failed write (written !== 1) skips the bump and logs this warning; the prompt stays unmarked and is retried by backfill.","triggerScenarios":"The one-document addDocuments call for a user prompt reports 0 written — Chroma request failed or was tolerated as a batch failure.","commonSituations":"Chroma temporarily unreachable during prompt capture, embedder error, timeout on a large prompt.","solutions":["Rely on the automatic retry/backfill for prompts.","Check Chroma availability and the underlying error in logs.","Confirm the prompt count catches up after Chroma recovers."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"async function chromaHealthy(baseUrl: string): Promise<boolean> {\n  try {\n    const res = await fetch(`${baseUrl}/api/v2/heartbeat`, { signal: AbortSignal.timeout(2000) });\n    return res.ok;\n  } catch {\n    return false;\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep Chroma up while sessions capture prompts.","Treat a single failed prompt write as queued work, not data loss."],"tags":["chroma","sync","watermark","write-failure","idempotency"],"backgroundTag":"partial-write-retry","analyzedSha":"e2d1df569a8f04075d40e92461128ece7cf04c82","analyzedAt":"2026-08-20T23:58:13.836Z","contentChangedAt":"2026-08-20T23:58:13.836Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}