From 53c9e9bf8921dcc49f611c204300ce1e5b610ed0 Mon Sep 17 00:00:00 2001 From: Matteo Landi Date: Sat, 8 Nov 2025 20:36:42 +0100 Subject: [PATCH] fix: Add 'file:' prefix to SQLite URIs in doctor.go (#261) Without the 'file:' URI scheme prefix, SQLite treats query parameters like '?mode=ro' as part of the filename instead of connection options. This caused: - Creation of bogus files named 'beads.db?mode=ro' - Failure to read database version from metadata table - bd doctor incorrectly reporting 'version pre-0.17.5 (very old)' Fixed two sql.Open() calls in doctor.go: - Line 317 (checkIssueIDs function) - Line 403 (getDatabaseVersionFromPath function) Now uses 'file:'+dbPath+'?mode=ro' pattern consistent with migrate.go. Fixes #260 Amp-Thread-ID: https://ampcode.com/threads/T-ac9832d6-15e4-4e25-8027-5e8b640b190b Co-authored-by: Amp --- cmd/bd/doctor.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/bd/doctor.go b/cmd/bd/doctor.go index 1f270c59..85495948 100644 --- a/cmd/bd/doctor.go +++ b/cmd/bd/doctor.go @@ -314,7 +314,7 @@ func checkIDFormat(path string) doctorCheck { } // Open database - db, err := sql.Open("sqlite3", dbPath+"?mode=ro") + db, err := sql.Open("sqlite3", "file:"+dbPath+"?mode=ro") if err != nil { return doctorCheck{ Name: "Issue IDs", @@ -400,7 +400,7 @@ func checkCLIVersion() doctorCheck { } func getDatabaseVersionFromPath(dbPath string) string { - db, err := sql.Open("sqlite3", dbPath+"?mode=ro") + db, err := sql.Open("sqlite3", "file:"+dbPath+"?mode=ro") if err != nil { return "unknown" }