Skip to content

Commit e6d3817

Browse files
anandgupta42claude
andauthored
fix(drivers): recover #1204 review debt — driver-e2e false-skip, file: URI checks, Windows paths, telemetry, docs (#1238)
* fix(drivers): recover #1204 review debt — driver-e2e false-skip, file: URI checks, Windows paths, telemetry, docs #1204 (fix/warehouse-store-path-resolution, merged 1caa234) shipped the core path-resolution fix but merged with only 2 of 47 review threads addressed. This recovers the real bugs and finishes the incomplete P1 left behind. Recovered from an orphaned agent worktree, re-applied and re-verified here: - drivers-e2e.test.ts: three bare connect({ type: "duckdb" }) calls threw under #1204's new requireStorePath() guard, so probeDuckDB() always self-caught and 39 of 50 tests in the file silently skipped even with the duckdb binding installed. Fixed by passing path: ":memory:". Verified independently: 11 pass/39 skip -> 36 pass/14 skip. - file-store.ts isLocalFilePath: the scheme-exclusion regex matched any "2+ letter prefix + colon", misreading a local filename shaped like data:warehouse.duckdb as a remote scheme. Narrowed to real scheme:// URIs plus DuckDB's specific non-slash extension schemes (md:, motherduck:, ducklake:). Added a regression unit test. Completed the incomplete P1 (absoluteFileUriPath() was written but never wired into assertStoreExists, so behavior was unchanged on main): - Wired absoluteFileUriPath() into assertStoreExists so a missing *absolute* file: URI now fails loudly instead of opening silently empty — the exact bug class #1204 exists to fix. Relative file: URIs are deliberately left alone (tracked separately as #1209). Added tests for both. Remaining live review threads, fixed with tests where testable: - registry.ts resolveStorePaths: POSIX path.isAbsolute() doesn't recognize C:\..., so a shared/migrated Windows config path got mangled by path.resolve. Fixed with path.isAbsolute() || path.win32.isAbsolute(). By-inspection only — no Windows CI. - warehouse-add.ts: tool description said a relative path resolves "against the directory of the config that declares it"; Registry.add() actually resolves against projectRoot() at add-time regardless of where it's persisted (the global config). Description corrected to match. - sql-execute.ts: SQL fingerprint telemetry was emitted only on the success path, so failed executions (including the new error-surfacing branch) never got fingerprinted — biasing telemetry away from failures. Extracted a shared emitSqlFingerprint() helper and call it from all three outcomes (success, result-shaped error, thrown exception). - docs/configure/warehouses.md: still said path was optional/omittable for DuckDB and SQLite in-memory; requireStorePath() now rejects that. Corrected in both the DuckDB and SQLite sections. - file-store.ts assertStoreExists: fs.existsSync is also true for a directory at that path, which would have let a misconfigured directory path through to a confusing driver-level error instead of this guard's clear one. Added an existsAsFile check. Out of scope: the registry cross-tenant-scoping P1 (registry.ts:80/:175, the process-global loaded state) is tracked separately as #1237 and needs its own design PR — not attempted here. Gates: bun test packages/drivers/ packages/opencode/test/altimate/ green (5007+317 pass, 0 fail), bun turbo typecheck 13/13, marker check --base origin/main --strict clean (no upstream-shared files touched), prettier clean on all newly-written content. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01VqnuBDGkh1ZT65Ti7e6DHZ * fix(drivers): address #1238 review — directory/create ordering, file: URI slashes, Windows paths, telemetry mislabel, post-probe failure Follow-up to #1238's own review round (8 threads, all on the new code that PR added). Verified each against current code before acting; fixed the real bugs with tests, replied with reasoning on the one genuine design call. - file-store.ts: `create: true` bypassed the new directory check entirely, since `if (allowCreate) return` ran before it — a directory path with `create: true` reached the driver instead of getting this guard's clear error. Extracted `rejectIfDirectory()` and moved it before the `allowCreate` bypass in both the plain-path and `file:` URI branches, since neither engine can create a database at a path that's already a directory. - file-store.ts `absoluteFileUriPath`: the leading-slash check was bounded to 1-3 slashes, so `file:////mnt/share/warehouse.duckdb` (UNC-style, 4+ slashes) was treated as relative and bypassed the existence guard. Verified `fileURLToPath` handles any number of leading slashes without throwing; widened the check to `/^\/+/`. - file-store.ts `isLocalFilePath`: the `scheme://` regex accepted a single-character scheme, so a doubled-slash Windows path like `C://data/warehouse.duckdb` matched it exactly like `s3://...` and was misclassified as remote. No real scheme is a single letter; require 2+ characters before `://`. - sql-execute.ts: the previous round's "fingerprint on every outcome" fix mislabeled the catch block. `sql.execute` never throws for a connection/query failure — it returns a result carrying `error`, already fingerprinted on the result-error branch. The catch block only fires when the query never reached a warehouse at all (e.g. dispatcher down), so fingerprinting it there folded "never executed" into a signal meant to measure "executed SQL", re-biasing the telemetry in the opposite direction. Removed the catch-block emission; kept it on success + result-error only. - drivers-e2e.test.ts: if DuckDB setup failed after the availability probe already passed, every test's `if (!duckdbReady) return` guard reported a pass instead of a failure — the same vacuous-green class as the false-skip bug, one layer down. Extracted `connectWithRetry()`, which now throws (with the underlying error) once retries are exhausted instead of swallowing it; `beforeAll` no longer catches that throw, so a genuine post-probe failure now fails the whole describe block. Added a standalone unit test for the helper that runs independent of real DuckDB availability. Not fixed — genuine design call, replied with reasoning, left open: a custom DuckDB extension using an unlisted bare `scheme:` form (e.g. `acme:catalog`) is no longer forwarded, because narrowing the bare-scheme exclusion to a closed list (to fix the `data:warehouse.duckdb` false-positive from the prior round) is in direct, unavoidable tension with forwarding arbitrary unknown bare schemes — nothing in the syntax alone can tell them apart. Gates: `bun test packages/drivers/` 323/323 pass, `bun test packages/opencode/test/altimate/` 5009/5009 pass (653 skip, unrelated), `bun turbo typecheck` 13/13, marker check `--base origin/main --strict` clean, prettier clean on every newly-written/substantially-edited file. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01VqnuBDGkh1ZT65Ti7e6DHZ * docs(drivers): record the bare-scheme-vs-local-filename decision (#1238 last thread) Documents the maintainer decision on #1238's remaining open thread (file-store.ts:61 — narrowing the bare-scheme exclusion to a closed list broke forwarding for an unlisted custom DuckDB extension's bare-scheme target). Decision: accept the closed-list default. - file-store.ts: expanded the comment at NON_SLASH_REMOTE_SCHEMES to state the fundamental ambiguity (a bare word:target cannot be told apart syntactically from a local filename with a colon), why the closed list was chosen over the broad heuristic (local filenames with colons are the common case; known extensions are enumerable), and the escape hatch (use the extension's scheme:// form, or extend the list when a new extension is adopted). - docs/configure/warehouses.md: new note in the DuckDB section explaining bare word:target values are treated as local files unless the prefix is one of the recognized bare schemes (md:, motherduck:, ducklake:). - docs/drivers.md: one-sentence pointer to the same rule alongside the existing file-backed-driver path notes. Gates: packages/drivers file-store-guard tests 27/27 pass, bun turbo typecheck 13/13 (forced, 0 cached), marker check --base origin/main --strict clean, prettier clean on file-store.ts (the two docs files were already unformatted on origin/main before this change, left as-is). Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01VqnuBDGkh1ZT65Ti7e6DHZ * fix(drivers): resolve #1238's round-3 threads — connector leak, error identity, fingerprint-on-format-throw, de-scope telemetry Fixes the 3 real bugs the round-3 review caught, and de-scopes the SQL fingerprint telemetry change per plan (approved by Anand). Bug fixes, with tests: - drivers-e2e.test.ts: the DuckDB beforeAll's connectWithRetry attempt built a connector (mod.connect()) and then opened it (c.connect()) as two separate steps. If the open step failed after the connector object already existed, the connector was dropped without close(), leaking the underlying native handle on every failed retry. Extracted connectOrClose(), which closes a half-open connector before rethrowing, and wired it into the beforeAll attempt. - drivers-e2e.test.ts: connectWithRetry's final throw was a plain new Error(message), discarding the last attempt's original error object — its stack, type, and any extra properties. Now thrown with { cause: lastError }, preserving the original through unmodified. - sql-execute.ts: the fingerprint emission ran after formatResult(result), so a genuinely-executed query went uncounted if formatting itself threw. Moved the fingerprint emission before formatResult(). De-scope (the key decision): reverted sql-execute.ts's fingerprint telemetry to fingerprint-on-success-only — the behavior that predates PR #1204. Three review rounds converged on the same root problem: sql.execute's result-shaped error (returned instead of throwing) is indistinguishable between "a warehouse ran the query and it failed" and "the query never reached a warehouse at all" (no warehouse configured, connector setup failed — see connections/register.ts). Fingerprinting the result-error branch therefore risked mislabeling never-executed queries as executed SQL — the opposite of what the original #1204 comment asked for. Rather than build a failed-execution-vs-never-executed taxonomy inside this cleanup PR, picked the smaller, clearly-correct change: fingerprint only what's provably executed (the success path). Removed the now-single-use emitSqlFingerprint helper, inlining the fingerprint block back into the success path. Follow-up issue #1242 captures the real fix: an explicit executed-phase signal from the sql.execute handler itself, which sql-execute.ts can branch on once it exists. Referenced from the code comment at the de-scoped result-error branch and from the updated structural test. Gates: packages/drivers + packages/opencode/test/altimate green (5013 + 323 pass, 0 fail), bun turbo typecheck --force 13/13 (0 cached), marker check --base origin/main --strict clean, prettier clean on sql-execute.ts (the two test files were already unformatted on origin/main before this PR touched them, per established practice). Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01VqnuBDGkh1ZT65Ti7e6DHZ * docs(warehouses): fix self-contradicting sentence in bare-scheme note (#1238 round-4 thread) The note added to explain the bare-word:target-vs-local-filename tradeoff read as self-contradicting: it said a bare word:target is "treated as an ordinary local filename... including the exact word prefix a DuckDB storage extension uses," which the very next sentence then said IS treated as remote for md:/motherduck:/ducklake:. Reworded in the intended, unambiguous order: local-by-default, named exceptions (md:/motherduck:/ducklake:) are remote, scheme:// forces remote for anything else. docs/drivers.md's one-line pointer already used this order and doesn't have the same confusion — left unchanged. Gates: marker check --base origin/main --strict clean. This file is part of the same pre-existing-formatting-drift set established earlier in this PR (not reformatted, per established practice). Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01VqnuBDGkh1ZT65Ti7e6DHZ --------- Co-authored-by: Claude Opus 4.8 <[email protected]>
1 parent 1caa234 commit e6d3817

9 files changed

Lines changed: 556 additions & 46 deletions

File tree

‎docs/docs/configure/warehouses.md‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ If you're already authenticated via `gcloud`, omit `credentials_path`:
261261

262262
| Field | Required | Description |
263263
|-------|----------|-------------|
264-
| `path` | No | Database file path. Omit or use `":memory:"` for in-memory |
264+
| `path` | Yes | Database file path, or `":memory:"` for in-memory. Cannot be omitted — a missing `path` is rejected rather than silently falling back to `":memory:"` |
265265
| `create` | No | Create the database file if it is missing (default: `false`) |
266266

267267
!!! warning "The store must already exist"
@@ -283,6 +283,15 @@ If you're already authenticated via `gcloud`, omit `credentials_path`:
283283
re-point an existing connection at a different file. Absolute paths are always
284284
safest.
285285

286+
!!! note "Bare `word:target` values are treated as local files"
287+
A `path` shaped like `word:target` with no `//` (for example
288+
`data:warehouse.duckdb`) is treated as an ordinary local filename by
289+
default. The only exceptions are `md:`, `motherduck:`, and `ducklake:` —
290+
these specific bare prefixes are recognized remote storage schemes and
291+
are always forwarded as remote targets. To force any other value to be
292+
treated as remote, use its full `scheme://` form (`s3://...`,
293+
`md://...`) instead of a bare prefix.
294+
286295
!!! note "Concurrent access"
287296
DuckDB does not support concurrent write access to the same file. If another process holds a write lock, Altimate Code automatically retries the connection in **read-only** mode so you can still query the data. A clear error message is shown if read-only access also fails.
288297

@@ -461,7 +470,7 @@ If you're already authenticated via `gcloud`, omit `credentials_path`:
461470

462471
| Field | Required | Description |
463472
|-------|----------|-------------|
464-
| `path` | No | Database file path. Omit or use `":memory:"` for in-memory |
473+
| `path` | Yes | Database file path, or `":memory:"` for in-memory. Cannot be omitted — a missing `path` is rejected rather than silently falling back to `":memory:"` |
465474
| `readonly` | No | Open in read-only mode (default: `false`) |
466475
| `create` | No | Create the database file if it is missing (default: `false`) |
467476

‎docs/docs/drivers.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,10 @@ MongoDB supports server versions 3.6 through 8.0. Queries use MQL (MongoDB Query
194194
For both file-backed drivers, the database must already exist — connecting never
195195
creates it. Pass `create: true` to create it deliberately. A relative `path`
196196
resolves against the directory of the config that declares it, not the current
197-
working directory. See [Warehouses](configure/warehouses.md#duckdb) for the full rules.
197+
working directory. A bare `word:target` value (no `//`) is treated as a local
198+
filename unless `word` is one of the recognized remote bare schemes
199+
(`md:`, `motherduck:`, `ducklake:`) — use a `scheme://` URI to target any other
200+
storage extension. See [Warehouses](configure/warehouses.md#duckdb) for the full rules.
198201

199202
## SSH Tunneling
200203

‎packages/drivers/src/file-store.ts‎

Lines changed: 150 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,37 @@
1313
*/
1414

1515
import * as fs from "fs"
16+
import { fileURLToPath } from "url"
1617
import type { ConnectionConfig } from "./types"
1718

19+
// altimate_change start — narrow the scheme exclusion to genuine remote/extension targets
20+
/**
21+
* DuckDB extension schemes that take a bare `scheme:rest` form with no `//`
22+
* — MotherDuck (`md:`) and DuckLake (`ducklake:`) — and so cannot be told
23+
* apart from a local filename by the `://` check below.
24+
*
25+
* Fundamental ambiguity: a bare `word:target` is syntactically identical
26+
* whether `word` is a filename prefix (`data:warehouse.duckdb`, a real local
27+
* file) or a remote extension scheme (`md:my_database`). Nothing in the
28+
* string alone can distinguish them.
29+
*
30+
* Deliberate choice: a closed list, not a broad heuristic. Local filenames
31+
* that happen to contain a colon are the common case here; bare-scheme
32+
* DuckDB extensions are a small, enumerable set. Listing the known ones and
33+
* treating everything else as local is safer than the reverse (treating
34+
* every `word:target` as remote, which misclassified real local files — see
35+
* `isLocalFilePath`'s own comment).
36+
*
37+
* Escape hatch: a custom/future extension whose target uses a bare scheme
38+
* not in this list is NOT forwarded — it's treated as a local path and will
39+
* fail the existence guard. Two ways out: (1) use the extension's `scheme://`
40+
* form if it has one (always forwarded, see the `://` check below), or (2)
41+
* add the new bare scheme to this list once it's an extension the driver
42+
* actually needs to support.
43+
*/
44+
const NON_SLASH_REMOTE_SCHEMES = ["md:", "motherduck:", "ducklake:"]
45+
// altimate_change end
46+
1847
/**
1948
* Whether `dbPath` names a file on the local filesystem, and so can be
2049
* existence-checked before the driver opens it.
@@ -29,16 +58,77 @@ import type { ConnectionConfig } from "./types"
2958
* A scheme-qualified target is not a local file: MotherDuck (`md:`), object
3059
* storage (`s3://`), DuckLake, and any other scheme a DuckDB extension
3160
* provides. Those are left to the driver, which reports an unknown scheme as a
32-
* missing-extension error rather than silently creating anything. The pattern
33-
* requires two or more characters before the colon so a Windows drive letter
34-
* (`C:\data\wh.duckdb`) stays a path.
61+
* missing-extension error rather than silently creating anything.
62+
*
63+
* altimate_change: the exclusion used to fire on ANY two-or-more-letter
64+
* prefix followed by a colon, which misclassified an ordinary local filename
65+
* that happens to contain one — `data:warehouse.duckdb`, `foo:warehouse.db`
66+
* — as a remote target, silently skipping both path resolution and the
67+
* existence guard below. Only a `scheme://` URI or one of the specific
68+
* non-slash extension schemes DuckDB actually recognizes is excluded now; a
69+
* `C:\...` Windows drive letter still passes through unaffected, since
70+
* neither pattern matches it. `file:` is deliberately still excluded here —
71+
* it is a real local path, but resolving/existence-checking it is handled
72+
* separately (see `absoluteFileUriPath` below) because it is not safe to
73+
* treat as an ordinary path string (see registry.ts's `resolveStorePaths`,
74+
* which would otherwise mangle it with `path.resolve`).
3575
*/
3676
export function isLocalFilePath(dbPath: string): boolean {
3777
if (dbPath === "" || dbPath === ":memory:") return false
38-
if (/^[a-zA-Z][a-zA-Z0-9+.-]+:/.test(dbPath)) return false
78+
if (/^file:/i.test(dbPath)) return false
79+
// altimate_change start — a single-letter "scheme" is a Windows drive letter, not a URI
80+
// A doubled-slash Windows path like `C://data/warehouse.duckdb` is a valid absolute
81+
// path (path.win32.normalize collapses it to `C:\data\warehouse.duckdb`), but the
82+
// scheme://-form regex below used to accept a one-character scheme, so `C:` matched
83+
// it exactly like `s3:` does. No real remote/extension scheme is a single letter —
84+
// require at least two characters before "://" so a drive letter is never mistaken
85+
// for one.
86+
if (/^[a-zA-Z][a-zA-Z0-9+.-]+:\/\//.test(dbPath)) return false
87+
// altimate_change end
88+
if (NON_SLASH_REMOTE_SCHEMES.some((scheme) => dbPath.toLowerCase().startsWith(scheme))) return false
3989
return true
4090
}
4191

92+
// altimate_change start — existence-check absolute `file:` URIs too
93+
/**
94+
* The on-disk path an ABSOLUTE `file:` URI names, or `undefined` if `dbPath`
95+
* is not a `file:` URI, is a relative one, or is one of SQLite/DuckDB's
96+
* in-memory or temporary URI forms (`file:`, `file::memory:`,
97+
* `file:name?mode=memory`) that never touch disk.
98+
*
99+
* Scoped deliberately narrow to the absolute case. This PR does not resolve a
100+
* relative `file:` URI against a base directory (registry.ts's
101+
* `resolveStorePaths` leaves `file:` paths untouched — see `isLocalFilePath`
102+
* above), so guarding a relative one's existence here would check whatever
103+
* the process's current directory happens to be, which is exactly the
104+
* cwd-following bug this PR exists to remove. An absolute `file:` URI names
105+
* one unambiguous location regardless of cwd, so it is safe to check.
106+
*/
107+
export function absoluteFileUriPath(dbPath: string): string | undefined {
108+
if (!/^file:/i.test(dbPath)) return undefined
109+
const rest = dbPath.slice("file:".length)
110+
if (rest === "" || rest.startsWith(":")) return undefined // file:, file::memory:
111+
if (/[?&]mode=memory\b/i.test(dbPath)) return undefined
112+
// altimate_change start — accept any number of leading slashes, not just 1-3.
113+
// `file:////mnt/share/warehouse.duckdb` (four or more slashes — seen with UNC-style
114+
// shares) is a valid absolute file: URI; fileURLToPath handles the extra slashes by
115+
// folding them into the resulting path (verified: `file:////x` -> `//x`), so there is
116+
// no reason to reject it here before even trying to parse it.
117+
const isSlashForm = /^\/+/.test(rest)
118+
// altimate_change end
119+
const isBareWindowsDrive = /^[a-zA-Z]:[\\/]/.test(rest)
120+
if (!isSlashForm && !isBareWindowsDrive) return undefined // relative — not this guard's job
121+
try {
122+
// fileURLToPath requires an authority (even an empty one); `file:C:/x`
123+
// needs a slash inserted before the drive letter to parse as one.
124+
const href = isBareWindowsDrive ? dbPath.replace(/^file:/i, "file:/") : dbPath
125+
return fileURLToPath(href)
126+
} catch {
127+
return undefined
128+
}
129+
}
130+
// altimate_change end
131+
42132
/**
43133
* The store path a file-backed connection names, or a loud failure.
44134
*
@@ -69,9 +159,40 @@ export function allowsCreate(config: ConnectionConfig): boolean {
69159
return config.create === true
70160
}
71161

162+
// altimate_change start — a directory at dbPath is never a valid store, with or
163+
// without `create`
164+
/**
165+
* Throw if `path` names an existing directory. A directory can never be
166+
* opened as a database by either engine, whether or not the caller passed
167+
* `create: true` — creation only ever means "create a missing FILE", not
168+
* "replace a directory". This must run before the `allowCreate` bypass in
169+
* `assertStoreExists`: `create: true` is meant to skip the "does this file
170+
* exist yet" check, not the "is this actually a directory" check, or a
171+
* misconfigured directory path reaches the driver and fails there with a
172+
* confusing engine-level error instead of this guard's clear one.
173+
*/
174+
function rejectIfDirectory(path: string, displayPath: string, engine: string): void {
175+
let isDir: boolean
176+
try {
177+
isDir = fs.existsSync(path) && fs.statSync(path).isDirectory()
178+
} catch {
179+
// A stat failure here (e.g. a race with a delete, or a permissions error)
180+
// is not this guard's to diagnose — let the driver's own open surface it.
181+
isDir = false
182+
}
183+
if (!isDir) return
184+
throw new Error(
185+
`${engine} database path is a directory, not a file: "${displayPath}". ` +
186+
`A directory can never be opened as a database — this applies even when "create" is set, ` +
187+
`since creation only ever means creating a missing file.`,
188+
)
189+
}
190+
// altimate_change end
191+
72192
/**
73-
* Throw unless the store is safe to open: it already exists, the caller opted
74-
* in to creating it, or the path is not a local file at all.
193+
* Throw unless the store is safe to open: it is not a directory, and it
194+
* either already exists, the caller opted in to creating it, or the path is
195+
* not a local file at all.
75196
*
76197
* @param engine Human-readable engine name used in the error message.
77198
* @param allowCreate Whether this open will actually create the store. Defaults
@@ -84,8 +205,30 @@ export function assertStoreExists(
84205
engine: string,
85206
allowCreate: boolean = allowsCreate(config),
86207
): void {
87-
if (allowCreate) return
208+
// altimate_change start — existence-check an absolute `file:` URI too;
209+
// `isLocalFilePath` deliberately excludes `file:` (see its own comment), so
210+
// without this branch every `file:` store — including absolute ones that
211+
// name one unambiguous on-disk location regardless of cwd — skipped the
212+
// guard entirely and a missing absolute file: store opened silently empty,
213+
// the exact bug class this guard exists to catch.
214+
const fileUriPath = absoluteFileUriPath(dbPath)
215+
if (fileUriPath !== undefined) {
216+
// altimate_change: the directory check MUST run before the `allowCreate`
217+
// bypass below — see rejectIfDirectory's own comment.
218+
rejectIfDirectory(fileUriPath, dbPath, engine)
219+
if (allowCreate) return
220+
if (fs.existsSync(fileUriPath)) return
221+
throw new Error(
222+
`${engine} database file not found: "${dbPath}" (resolved to "${fileUriPath}"). ` +
223+
`Opening a warehouse connection never creates the database — an empty store would answer every query with no rows. ` +
224+
`Check the "path" in your connection config, or pass "create": true if this store is meant to be created.`,
225+
)
226+
}
227+
// altimate_change end
88228
if (!isLocalFilePath(dbPath)) return
229+
// altimate_change: same ordering requirement as the file: URI branch above.
230+
rejectIfDirectory(dbPath, dbPath, engine)
231+
if (allowCreate) return
89232
if (fs.existsSync(dbPath)) return
90233
throw new Error(
91234
`${engine} database file not found: "${dbPath}". ` +

0 commit comments

Comments
 (0)