Skip to content

Fix DuckDB connection pool with database path validation#524

Merged
jfrench9 merged 1 commit intomainfrom
bugfix/duckdb-pool-bug
Mar 22, 2026
Merged

Fix DuckDB connection pool with database path validation#524
jfrench9 merged 1 commit intomainfrom
bugfix/duckdb-pool-bug

Conversation

@jfrench9
Copy link
Member

Summary

Fixes a bug in the DuckDB connection pool by adding path validation logic. The DuckDBConnectionPool now validates the database file path before attempting to establish connections, preventing errors caused by invalid or missing paths.

Key Accomplishments

  • Added path validation: Introduced validation checks for the DuckDB database file path within the connection pool, ensuring the path is verified before connections are created
  • Improved error resilience: Prevents the pool from entering a broken state when initialized with an invalid or nonexistent database path
  • Proactive failure handling: Connections now fail fast with clear errors rather than producing cryptic downstream failures

Breaking Changes

None. This is a purely additive fix that adds validation guards without altering existing public interfaces or behavior for valid paths.

Testing Notes

  • Verify that the connection pool correctly initializes when provided with a valid DuckDB database path
  • Confirm that an appropriate error is raised when an invalid or nonexistent path is supplied
  • Test pool behavior under concurrent access to ensure the validation does not introduce race conditions or performance regressions
  • Validate that existing workflows relying on the DuckDB connection pool continue to function as expected

Infrastructure Considerations

  • No new dependencies or configuration changes required
  • The fix is contained within the connection pool module and does not affect deployment or infrastructure setup
  • Environments that rely on dynamically resolved database paths should ensure those paths are valid at pool initialization time

🤖 Generated with Claude Code

Branch Info:

  • Source: bugfix/duckdb-pool-bug
  • Target: main
  • Type: bugfix

Co-Authored-By: Claude noreply@anthropic.com

- Added a defense-in-depth check to ensure the resolved database path remains within the base directory, raising a ValueError if it escapes the intended directory.
@jfrench9 jfrench9 merged commit b32d2d2 into main Mar 22, 2026
11 checks passed
@jfrench9 jfrench9 deleted the bugfix/duckdb-pool-bug branch March 22, 2026 05:25
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.

1 participant