| Previous | Next |
| hrInTransaction | hrDatabaseInUse |
hrDatabaseDuplicate
The object and state that matter
hrDatabaseDuplicate means database creation selected a path or identity that already exists.
This is the legacy Directory Service backup/restore HRESULT form of JET_errDatabaseDuplicate (0xC80004B1).
The key comparison is: hrDatabaseAttached means an existing database is attached; this code is the duplicate-create boundary. The first useful observation is to record canonical path, file identity, attach state, and whether a previous create partially succeeded. This evidence separates file identity, attachment, open-handle ownership, lock state, and structural validity.
Minimum useful trace
- Code-specific observation: record canonical path, file identity, attach state, and whether a previous create partially succeeded.
- the instance attachment list plus every session-scoped JET_DBID; associate it with this result rather than with a later generic exception.
- open tables, transactions, maintenance, and recovery activity using the database; associate it with this result rather than with a later generic exception.
- the canonical database path and file identity.
How to avoid a false diagnosis
hrDatabaseCorrupted | the database cannot be trusted as a coherent ESE file or is unavailable in a way reported as corruption |
|---|---|
hrDatabaseInUse | the database still has open users or handles that block detach, delete, or exclusive work |
hrInvalidDatabaseId | the JET_DBID no longer identifies an open database in the supplied session |
The ESE objects in play
| Diagnostic layer | database file, attachment state, JET_DBID ownership, and database lifecycle |
|---|---|
| Typical API surface | JetCreateDatabase, JetAttachDatabase, JetOpenDatabase, JetCloseDatabase, and JetDetachDatabase |
| Code-specific condition | database creation selected a path or identity that already exists |
| First corrective direction | open or attach the intended existing database, or create a new one at an unambiguous path |
Attachment is an instance relationship; opening a database returns a session-scoped database ID. Close and detach are separate lifecycle steps and can fail for different outstanding owners.
Safe recovery sequence
- Freeze the failing request context and record
0xC80004B1, the Jet API name, and the current instance/session ownership. - Verify the code-specific precondition: record canonical path, file identity, attach state, and whether a previous create partially succeeded.
- Apply the targeted fix: open or attach the intended existing database, or create a new one at an unambiguous path.
- Before retrying the operation, reconcile attachment, open/closed state, file identity, and database header status.
Actions that can hide or worsen the problem
- Do not create an empty database at the expected path as a substitute for the missing or damaged artifact.
- Do not force detach or delete while owners and recovery state are unknown.
Technical references
Looking for a different code? Search another status or error code.
