Embedded Postgres Dies On macOS Disk Pressure
When a local app or AI-agent workspace writes scheduled backups until the disk is full, embedded Postgres can die on ENOSPC and leave health checks stuck at database unreachable. The safe fix is not just more cleanup. Gate writes before backup, prune old backups first, and supervise restart with a clear failure state.
No mail app or GitHub login? Send this directly from any inbox.
liuminsheng3@gmail.com - SafeDisk Embedded Postgres Incident Review Payment Link
Get a safe backup, Postgres, and agent-heartbeat recovery order.
The $29 review covers one local embedded Postgres ENOSPC incident: backup free-space gates, prune-before-write order, database restart boundaries, and what not to delete from app support or agent state.
df -h "$HOME" /tmp; du -sh "$HOME/Library/Application Support"/* 2>/dev/null | sort -h | tail -30
Request the $29 embedded Postgres recovery review.
Email is enough to request the payment link. Add only a public-safe symptom; do not paste database contents, credentials, transcripts, or private app logs.
Recovery Runbook
For local apps with embedded Postgres, the recovery order should protect database state first, then reduce backup pressure, then restart the database process with bounded attempts.
- Check free bytes before backup writes. Skip backup if the target volume is below the configured reserve.
- Prune or rotate old backups before starting the next backup, not after a successful backup.
- Put backup temp files on the same target volume so free-space checks match where bytes are written.
- Supervise embedded Postgres with a bounded restart loop and a clear gave-up state.
- Keep app support folders, databases, credentials, transcripts, and agent state review-first.
Use this when backups kill embedded Postgres on low disk.
This keeps the fix focused on pre-write gates and supervised recovery instead of broad cleanup after data loss.
This looks like a write-before-prune failure: the scheduled backup should prove target free space and prune old backups before opening the next backup file. Once ENOSPC kills embedded Postgres, a health probe alone is not enough; the supervisor needs a bounded restart path and an explicit gave-up state.
Read-only evidence I would capture first:
df -h "$HOME" /tmp
df -i "$HOME" /tmp
du -sh "$HOME/Library/Application Support"/* 2>/dev/null | sort -h | tail -30
find "$HOME" -maxdepth 5 -type f \( -name "*.dump" -o -name "*.backup" -o -name "*.sqlite" -o -name "*.log" \) -size +500M -print0 2>/dev/null | xargs -0 du -h 2>/dev/null | sort -hr | head -40
For the fix, I would add: min-free-gb gate before backup, aggressive prune threshold before writing, temp file on the target volume, bounded Postgres restart attempts, and a health response that distinguishes disk_pressure, restarting, and gave_up.
Do Not Delete First
- Postgres data directories, write-ahead logs, or local database files without a known-good backup.
- Application Support folders that contain agent state, credentials, transcripts, or local projects.
- Current backup temp files until the backup runner has stopped.
- Agent heartbeat state before you know whether the database can be restarted cleanly.