| Previous | Next |
| REGDB_E_READREGDB | REGDB_E_KEYMISSING |
REGDB_E_WRITEREGDB
Could not write key to registry
Windows defines REGDB_E_WRITEREGDB as 2147746129 (0x80040151; signed value -2147221167). The documented description is “Could not write key to registry”. A COM registration operation could not write required registry data. The relevant operation is registration, self-registration, category updates, or activation metadata changes.
Where it is raised
COM registration is architecture-, scope-, and identity-sensitive. A key visible in Registry Editor is not proof that the failing process sees the same view or that the values form a coherent activation contract.
- Associate this result with one exact operation in CLSID/IID registry lookup, InprocServer32 or LocalServer32 metadata, interface proxy registration, package policy, and threading-model interpretation.
- Confirm that this result came from registration, self-registration, category updates, or activation metadata changes, rather than from cleanup or a wrapper that ran afterward.
Telemetry checklist
- Record the exact write operation, hive, view, value type, and security token.
- Use installer logs and registry auditing instead of retrying regsvr32 blindly.
- Check for partial registration so rollback can remove only values created by this attempt.
Why it is specific
- It can result when the installer or registration tool lacks write permission.
- It can result when a key is protected by policy, ownership, virtualization rules, or package boundaries.
- It can result when the registry transaction fails because another deployment is modifying or deleting the same hierarchy.
Investigation order
- Identify the exact object, method, and lifecycle phase involved in registration, self-registration, category updates, or activation metadata changes.
Safe handling
Correction. run the supported installer or deployment mechanism with the required privilege and repair the product atomically. Retry condition. Retry only after the lock, policy, or privilege condition changes; preserve rollback data before another write attempt. Before repeating the operation, complete or roll back the installer transaction, re-read the exact user or machine registry view, and discard class factories obtained from superseded registration.
Practical scenario
A per-user registration routine tries to update a machine-wide InprocServer32 key from a standard-user process; moving the write into the elevated installer resolves ownership.
Difference from related HRESULTs
REGDB_E_READREGDB concerns lookup; it concerns mutation and therefore requires special attention to partial changes and rollback.
Developer and administrator guidance
References
Looking for a different code? Search another status or error code.