Skip to content

fix: escape '#' in SQLite URI paths to prevent truncation#2150

Merged
steveyegge merged 1 commit intosteveyegge:mainfrom
zerone0x:fix/sqlite-uri-hash-escape
Feb 26, 2026
Merged

fix: escape '#' in SQLite URI paths to prevent truncation#2150
steveyegge merged 1 commit intosteveyegge:mainfrom
zerone0x:fix/sqlite-uri-hash-escape

Conversation

@zerone0x
Copy link
Contributor

Summary

Fixes #2115

Paths containing # (e.g., /workdir/#category/project) were silently truncated by the SQLite URI parser because # starts a URI fragment per RFC 3986. This caused bd list and other commands to fail with:

Error: failed to open database: failed to enable WAL mode: sqlite3: unable to open database file

Changes

  • cmd/bd/doctor_health.go: Escape # as %23 in the database path before constructing the SQLite URI
  • cmd/bd/migrate_dolt.go: Same fix for the SQLite extraction path used during migration

Root Cause

The SQLite URI file:/path/#dir/db.sqlite?mode=ro is parsed as:

  • Path: /path/ (truncated at #)
  • Fragment: dir/db.sqlite?mode=ro (silently discarded)

After the fix: file:/path/%23dir/db.sqlite?mode=ro — the # is percent-encoded so the full path is preserved.


🤖 Generated with Claude Code

Paths containing '#' (e.g., /workdir/#category/project) were silently
truncated by the SQLite URI parser because '#' starts a URI fragment.
This caused 'bd list' and other commands to fail with "unable to open
database file" when the working directory contained '#'.

Fixes steveyegge#2115

Co-Authored-By: Claude <noreply@anthropic.com>
@steveyegge steveyegge merged commit e5647f7 into steveyegge:main Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bd list does not work inside path with '#' symbol

2 participants