codegraph icon indicating copy to clipboard operation
codegraph copied to clipboard

disk I/O error on Windows network drive (Y: mapped drive, SMB share)

Open xiaoyingv opened this issue 6 months ago • 2 comments

Bug Report

CodeGraph version: 0.9.4 → 0.9.5
OS: Windows 11 Pro 10.0.26100
Node: v24.12.0
Working directory: mapped network drive (Y:\, SMB share)

Description

Running codegraph index or any MCP tool call consistently fails with:

Failed to open SQLite via the built-in node:sqlite module.
CodeGraph requires node:sqlite (Node.js 22.5+).
Underlying error: disk I/O error

Steps to Reproduce

  1. Open a project on a Windows mapped network drive (e.g., Y:\)
  2. Run codegraph init → succeeds
  3. Run codegraph index → fails with disk I/O error

Workaround

  1. Disconnect CodeGraph MCP server
  2. Delete .codegraph/codegraph.db, .db-shm, .db-wal, .lock
  3. Run codegraph init && codegraph index
  4. Reconnect MCP server

This workaround works initially, but the error can recur if the MCP server connection drops and restarts while the SQLite WAL lock is held on the network share.

Root Cause

SQLite's WAL mode relies on strict file locking (flock/fcntl) which is unreliable over SMB/CIFS network shares. The .db-shm (shared memory) file in particular doesn't behave correctly on network filesystems.

Environment Details

Working directory: Y:\ → mapped network drive (SMB)
npm global: C:\Users\<user>\AppData\Roaming\npm
codegraph: 0.9.5 (via npm i -g @colbymchenry/codegraph)
codegraph status output:
- Backend: node:sqlite (Node built-in) — full WAL + FTS5
- Journal mode: wal (concurrent reads safe)
- Files indexed: 372, Nodes: 5234, Edges: 8559
- DB size: 9.51 MB

Suggestion

Consider adding an option to use SQLite in non-WAL journal mode (DELETE or TRUNCATE) when the project is detected on a network drive, or allow the user to configure the journal mode. This would trade some concurrent-read performance for compatibility with network filesystems.

Related: #238 (database is locked on concurrent access)

xiaoyingv avatar May 26 '26 09:05 xiaoyingv

Open balance

treytracedit-lab avatar Jun 03 '26 23:06 treytracedit-lab

Sorry this sat for so long. On current main we couldn't reproduce it on Windows 11. Working through an SMB path, codegraph init, index, sync, status and MCP calls all worked, including right after the background server was force-killed and left its -wal/-shm files behind.

A loopback share isn't a NAS, though, and SQLite's WAL mode needs file-locking support that some SMB servers lack. If it still happens for you on 1.6.2, please reopen with what serves the share (Windows Server, a Samba version, a NAS model, or macOS file sharing), your codegraph status output and the full error text.

colbymchenry avatar Oct 22 '26 01:10 colbymchenry