Error Messages
Connection Errors
Disallowed connections with a different configuration
If you create different connections with the same connection database path (such as md:my_db
) but a different configuration dictionary, you may encounter the following error:
Connection Error: Can't open a connection to same database file with a different configuration than existing connections
This validation error prevents accidental retrieval of a previously cached database connection, and can happen only in DuckDB APIs that make use of a database instance cache. In file-based DuckDB, this can only happen when the previous connection is still in scope. With MotherDuck, the database instance cache is longer lived, so you may see this error even after the previous connections have been closed.
How To Recover
For multiple connections that are used sequentially:
- If the configuration does not need to differ, consider unifying it, which will allow the same underlying client-side database instance to be reused.
- If the configuration differs intentionally, set the database instance TTL to zero and close the previous connections.
For multiple connections whose lifecycles need to overlap, add a differentiating suffix to the connection string, so that these connections are no longer considered to be backed by the same database.
A good differentiating string is the session_hint
.
While it is meant to associate an individual end user to a dedicated backend when used with read scaling tokens, it can also be used to signal client-side intent for a distinct database instance when used with regular tokens.