| Previous | Next |
| hrRecordClusteredChanged | hrAlreadyPrepared |
hrKeyDuplicate
Diagnostic focus
hrKeyDuplicate means an insert or update would violate a unique or primary index key.
This is the legacy Directory Service backup/restore HRESULT form of JET_errKeyDuplicate (0xC8000645).
The key comparison is: hrIndexDuplicate concerns schema names; this code is duplicate row-key data. The first useful observation is to record index name, fully encoded key segments, null handling, transaction snapshot, and existing row bookmark. This evidence separates index schema, current-index cursor state, key construction, and duplicate data.
The ESE objects in play
| Diagnostic layer | B-tree index definition, key construction, uniqueness, and current-index cursor state |
|---|---|
| Typical API surface | JetCreateIndex, JetDeleteIndex, JetSetCurrentIndex, JetMakeKey, JetSeek, and JetSetIndexRange |
| Code-specific condition | an insert or update would violate a unique or primary index key |
| First corrective direction | treat it as a concurrency/data-integrity outcome and use an idempotent lookup-or-update strategy |
Index schema and runtime key-building state are separate diagnostic layers. Key bytes depend on segment order, column representation, collation, null rules, and sort direction.
Evidence that resolves the ambiguity
- Code-specific observation: record index name, fully encoded key segments, null handling, transaction snapshot, and existing row bookmark.
- the raw index key definition, flags, locale, and conditional columns; associate it with this result rather than with a later generic exception.
- the current index plus every JetMakeKey segment and grbit; associate it with this result rather than with a later generic exception.
- the encoded key and existing row when uniqueness is involved.
Nearby results that mean something different
hrIndexNotFound | the requested index name is valid but absent from the table |
|---|---|
hrKeyIsMade | a new key-building sequence was started or modified after the current search key was already complete |
hrIndexMustStay | the requested delete would remove an index required by the table layout, commonly the clustered index |
A disciplined correction path
- Freeze the failing request context and record
0xC8000645, the Jet API name, and the current instance/session ownership. - Verify the code-specific precondition: record index name, fully encoded key segments, null handling, transaction snapshot, and existing row bookmark.
- Apply the targeted fix: treat it as a concurrency/data-integrity outcome and use an idempotent lookup-or-update strategy.
- Before retrying the operation, reconcile index definition, selected cursor index, and key or uniqueness outcome.
Actions that can hide or worsen the problem
- Do not drop or rebuild an index before checking uniqueness and table-layout dependencies.
- Do not treat a key-construction or duplicate-key result as database-file corruption.
Technical references
Looking for a different code? Search another status or error code.