| Previous | Next |
| hrIndexCantBuild | hrIndexDuplicate |
hrIndexHasPrimary
Why this is more specific than the message text
hrIndexHasPrimary means the table already has a primary index and the request attempts to define another.
This is the legacy Directory Service backup/restore HRESULT form of JET_errIndexHasPrimary (0xC800057A).
The key comparison is: hrIndexHasClustered is about clustered layout; primary and clustered concepts can overlap but are not interchangeable. The first useful observation is to enumerate index flags and identify which migration owns the existing primary definition. This evidence separates index schema, current-index cursor state, key construction, and duplicate data.
Related ESE conditions
hrIndexHasClustered | the table already owns a clustered index and cannot accept another clustered layout |
|---|---|
hrIndexInUse | an index definition is being used by an open cursor or operation that prevents the requested schema change |
hrIndexDuplicate | an index with the requested name or equivalent definition already exists |
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 | the table already has a primary index and the request attempts to define another |
| First corrective direction | reuse or replace the existing primary index through a planned schema migration |
Key bytes depend on segment order, column representation, collation, null rules, and sort direction. Clustered, primary, and unique properties must be interpreted from the actual index flags.
Data for a reproducible case
- Code-specific observation: enumerate index flags and identify which migration owns the existing primary definition.
- 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.
- the encoded key and existing row when uniqueness is involved.
Corrective workflow
- Freeze the failing request context and record
0xC800057A, the Jet API name, and the current instance/session ownership. - Verify the code-specific precondition: enumerate index flags and identify which migration owns the existing primary definition.
- Apply the targeted fix: reuse or replace the existing primary index through a planned schema migration.
- 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.