Relationships
#3552 A --repo-dir or SWAMP_REPO_DIR through a symlink fails with 'unable to open database file'
Opened by hammz · 10/16/2026
What happens
Any command given a repo dir whose path passes through a symlink, by --repo-dir or SWAMP_REPO_DIR, fails before it does anything:
$ mkdir real && ln -s real link && swamp repo init link/r --tool none
$ cd link/r && swamp model search --repo-dir "$(pwd -L)" --json
{
"error": "unable to open database file: /…/link/r/.swamp/_extension_catalog.db",
"code": "ERR_SQLITE_ERROR"
}The same repo works when reached through its cwd, or through --repo-dir spelled with the real path. swamp extension push and quality fail the same way. Seen on Linux with 20261016.163909.0-sha.fcf98aa1. macOS /tmp and /var are symlinks, so --repo-dir /tmp/… hits this there.
Cause
Deno's node:sqlite refuses to open a database whose path contains a symlink anywhere: new DatabaseSync("link/t.db") throws unable to open database file while new DatabaseSync("real/t.db") succeeds (deno 2.9.7). findAncestorRepoDir (src/cli/context.ts) resolves symlinks for the cwd, which is why cwd-based runs work, but resolveRepoDir / getRepoDirFromArgs only resolve() the flag and env values, and ExtensionCatalogStore (and every other SQLite open under .swamp/) opens the path as given.
Expected
The repo dir used to open databases is the symlink-resolved path. Paths swamp prints still use the spelling the user gave (see swamp-club#3536).
Found while triaging swamp-club#3536.
Open
Click a lifecycle step above to view its details.
Sign in to post a ripple.