Skip to content

DuckDB Driver throws "IO Error: File is already open in node.exe" and locks DB file permanently on connect/disconnect (VS Code, Windows) #54

@mamercio

Description

@mamercio

I'm experiencing a consistent problem using the Evidence SQLTools DuckDB driver in VS Code on Windows (Tested with Node.js v20.x and v18.x):

On initial connection, the database (.duckdb) opens, and I can sometimes run a few queries.

After disconnecting, refreshing, or performing certain operations (e.g., closing/opening different connections, running operations on the database), the extension fails and the following error appears:

text
IO Error: File is already open in C:\Program Files\nodejs\node.exe (PID XXXX)
The Language Server process closes and restarts, but the file remains locked/unusable until VS Code is fully closed and reopened.

The error persists regardless of cleaning globalStorage, deleting/reinstalling extension folders, trying with new database files, changing database paths, or using Node 18 vs 20.

The problem does not occur when using DuckDB CLI or PowerShell directly: read/write access works fine outside VS Code, confirming that the lock is not at OS or file system level.

Other related SQLTools drivers for DuckDB show similar lock issues, but this one cannot be resolved by killing background processes or cleaning VS Code state.

Steps to reproduce:

Fresh install VS Code + Evidence SQLTools DuckDB driver (tested v1.0.0).

Set up a new DuckDB database anywhere local.

Connect to DB, run a short test query successfully.

Disconnect or run some operation (refresh connection, select from another CSV, open/close connections).

Error "File is already open in node.exe (PID...)" appears; file is locked from further access in VS Code.

Must restart VS Code (and sometimes Windows) to recover, but error eventually reappears.

Environment:

Windows 10/11, VSCode latest stable

Node.js tested in v20.x and v18.x (LTS and current, both official builds)

Evidence SQLTools DuckDB driver v1.0.0 (and earlier)

DuckDB databases created via CLI/PowerShell

Additional Logs:
(attached below)

Details from VS Code extension output and Language Server logs:

text
ERROR: Error opening connection Connection got disposed., {}
IO Error: File is already open in C:\Program Files\nodejs\node.exe (PID XXXX)
What I've tried:

Cleaning %APPDATA%\Code\User\globalStorage

Deleting all evidence.sqltools-duckdb-driver-* and mtxr.sqltools-* in .vscode/extensions

Reinstalling Node.js, VS Code, Evidence extension

Changing database path and name

Creating database from scratch via CLI/PowerShell (RW access confirmed outside VS Code)

Expected:

After disconnect or operation, DuckDB file should be released cleanly and not locked by node.exe.

Actual:

File remains locked until total application restart; error persists across versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions