Skip to main content
← Back to list
01Issue
BugShippedSwamp CLI
Assigneesstack72

#288 datastore compact: VACUUM fails in compiled binary (SQLITE_LIMIT_ATTACHED=0)

Opened by stack72 · 5/7/2026· Shipped 5/7/2026

Summary

swamp datastore compact crashes with ERR_SQLITE_ERROR: too many attached databases - max 0 when run from a compiled swamp binary. SQLite's VACUUM internally creates a temporary attached database, but the canary Deno denort runtime (pinned at 19bd3d8b) embedded by deno compile --unstable-bundle has SQLITE_LIMIT_ATTACHED=0.

The WAL checkpoint step works fine — only the VACUUM step fails.

Reproduction

swamp repo init
swamp datastore compact --json

Returns exit code 1 with:

{
  "error": "too many attached databases - max 0",
  "code": "ERR_SQLITE_ERROR"
}

Running the same code under deno test (stable v2.7.14) works because the stable runtime has SQLITE_LIMIT_ATTACHED > 0.

Impact

  • Datastore UAT compact tests have never passed (added in swamp-uat commit 75a40068, 2026-05-06)
  • WAL checkpoint (the main space-saving operation) is unaffected
  • Only the VACUUM page-reclamation step is broken

Proposed fix

Wrap the VACUUM call in CatalogStore.vacuum() with a try/catch. On failure, log a warning and skip vacuum — compact still checkpoints the WAL and reports dbBytesReclaimed: 0. When the canary bridge is removed (Deno v2.8.0), VACUUM will start working automatically.

References

02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 1 MOREASSIGNED+ 2 MOREREVIEW+ 3 MOREPR_MERGEDCOMPLETE

Shipped

5/7/2026, 10:30:21 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack725/7/2026, 9:41:10 PM

Sign in to post a ripple.