From 4c02378e895c0532e559b2070d60971e5791a45d Mon Sep 17 00:00:00 2001 From: carlos-alm Date: Mon, 6 Jul 2026 00:31:33 -0600 Subject: [PATCH] fix: log statSync failures in findDbPath instead of silently swallowing them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The catch block in resolveCustomDbPath (part of the findDbPath flow) caught all fs.statSync errors — including unexpected ones like EACCES or symlink loops — indistinguishably from the expected "path doesn't exist yet" case, leaving no diagnostic trail. Add a debug() call matching this file's existing convention (18 other catch blocks already do this). Fixes #1750 Impact: 1 functions changed, 68 affected --- src/db/connection.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/db/connection.ts b/src/db/connection.ts index a4ec10d3..8933c062 100644 --- a/src/db/connection.ts +++ b/src/db/connection.ts @@ -278,8 +278,11 @@ function resolveCustomDbPath(customPath: string): string { } return path.join(resolved, '.codegraph', 'graph.db'); } - } catch { + } catch (e) { // Path doesn't exist yet — return as-is (e.g. a future custom DB path). + debug( + `findDbPath: statSync failed for ${resolved}, treating as non-existent: ${toErrorMessage(e)}`, + ); } return resolved; }