thedotmack/claude-mem · warning
Cloud sync flush failed; unsynced rows remain queued
Error message
Cloud sync flush failed; unsynced rows remain queued
What it means
CloudSync.flush pushes queued rows (with NULL synced markers) to the cloud API. On any error, rows remain queued (still NULL), lastError is set, and an exponential-backoff retry is scheduled; this warning reports the failure and next retry delay.
Solutions
- Check this.lastError / logged err for the root cause (network vs HTTP status vs auth).
- If auth-related, refresh credentials/API key and let the backoff retry succeed.
- Verify network connectivity; flush resumes automatically via scheduleRetry and notify().
- Check cloud service status/endpoint health if 5xx persists.
- Reduce flush batch size if payload-too-large errors occur.
Defensive patterns
Strategy: retry
Validate before calling
// probe connectivity/auth before flushing
const res = await fetch(cloudEndpoint, { method: 'HEAD' });
if (!res.ok) console.warn(`cloud endpoint unhealthy: ${res.status}; flush will retry`); Try / catch
try { await flush(); }
catch (e) {
const err = e instanceof Error ? e : new Error(String(e));
console.warn(`flush failed; rows stay queued, retry in ${nextBackoffMs}ms`, err);
scheduleRetry();
} Prevention
- Keep credentials refreshed and validate them at startup
- Monitor lastError for persistent failure patterns
- Ensure notify() is called after network recovery to trigger an early flush
- Keep flush payloads within server size limits
- Treat queued (NULL-synced) rows as durable; never drop them on flush error
When it happens
Trigger: The HTTP upload inside flush throws — network offline, auth token expired, server 5xx, payload rejected, timeout — during start() or a timer-driven flush.
Common situations: Laptop offline or sleeping mid-sync, expired API credentials, cloud service outage, oversized flush payload hitting server limits.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
- chroma-mcp connection in backoff
- Pull wedged: the same page keeps failing; backing off and…
- Service initializing
- sync hub pull
- Anthropic API error
AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17).
Data as JSON: /api/errors/2ee64570594238c7.
Report an issue: GitHub.
Appendix: source
Thrown at src/services/sync/CloudSync.ts:598
try {
this.dropStaleOriginDeviceIdSnapshots();
do {
this.flushAgainRequested = false;
await this.drainContentOutbox();
await this.drainMutations();
for (const kind of KINDS) {
await this.drainKind(kind);
}
} while (this.flushAgainRequested && !this.stopped);
if (this.stopped) return; // shutdown mid-flush — skip success bookkeeping
this.lastFlushAt = Date.now();
this.lastError = null;
this.resetBackoff();
} catch (error) {
const err = error instanceof Error ? error : new Error(String(error));
this.lastError = err.message;
// Rows stay NULL — retried by the backoff timer below and on next notify().
logger.warn('CLOUD_SYNC', 'Cloud sync flush failed; unsynced rows remain queued', {
retryInMs: this.nextBackoffMs,
}, err);
this.scheduleRetry();
} finally {
this.flushing = false;
}
}
status(): CloudSyncStatus {
return {
configured: this.isConfigured(),
deviceId: this.deviceId,
pending: {
observations: this.countPending('observations'),
summaries: this.countPending('session_summaries'),
prompts: this.countPending('user_prompts'),
mutations: this.countPendingMutations(),
tombstones: this.countPendingTombstones(),View on GitHub (pinned to d8bc9755e7)