Skip to content

[bug] sqlite3: unable to open database file on Windows during pituitary index --rebuild (Stroma snapshot) #404

@spacepenguin13

Description

@spacepenguin13

Written by Gemini 3.1 pro:
Description
Running pituitary index --rebuild on Windows fails consistently with a sqlite3: unable to open database file error during the Stroma staging index creation phase.

The issue appears to be related to how the internal Go SQLite driver parses or constructs paths on Windows (likely an issue with URI connection strings and Windows drive letters like C:), as the target directories exist, are fully writable, and have no permission issues.

Steps to Reproduce

  1. Initialize a repository on a Windows machine.
  2. Ensure a valid pituitary.toml is present (either via pituitary init or manually created).
  3. Run the indexing command:

1 pituitary index --rebuild

Expected Behavior
The index rebuilds successfully and creates the .pituitary/pituitary.db SQLite file.

Actual Behavior
The chunking and embedding phases complete, but the process fails when attempting to open the staging index:

1 pituitary index: chunking 9/9 doc doc://README (10 chunk(s))
2 pituitary index: embedding 9/9 doc doc://README (10 chunk(s))
3 pituitary index: rebuild failed:
4 build stroma snapshot: open staging index: enable foreign keys: sqlite3: unable to open database file

Environment

  • OS: Windows (win32)
  • Pituitary Version: 1.0.0-beta.12
  • Go Version: go1.25.10
  • Commit: 9504834

Additional Context / Troubleshooting Performed
To rule out local environmental issues, we systematically tested the following index_path configurations in
pituitary.toml, all of which failed:

  1. Default relative path: .pituitary/pituitary.db (Directory manually created and confirmed writable).
  2. Absolute Windows path: C:\Users....pituitary\pituitary.db
  3. Short root path: C:\temp\pituitary.db (To rule out path length or user-profile permission issues).
  4. In-memory: :memory: (This yielded a different path parsing error: The filename, directory name, or volume label syntax is incorrect.).
  5. URI format: file:///C:/temp/pituitary.db

The fact that the error occurs specifically during build stroma snapshot: open staging index suggests that the code constructing the temporary/staging database path might be prefixing a URI scheme (file:) to a Windows absolute path (C:...), causing the underlying SQLite driver to interpret the drive letter as an invalid URI scheme.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions