What does HRESULT 0x80040165 (CS_E_NOT_DELETABLE) mean?

 
Previous Next
CS_E_PACKAGE_NOTFOUND CS_E_CLASS_NOTFOUND

CS_E_NOT_DELETABLE

Deleting this will break the referential integrity of the software installation data in the Active Directory.

Windows defines CS_E_NOT_DELETABLE as 2147746149 (0x80040165; signed value -2147221147). AllStat’s description is “Deleting this will break the referential integrity of the software installation data in the Active Directory.” The code marks a specific failure: deleting the class-store object would break referential integrity. The relevant operation is removing directory-backed software-installation metadata referenced by other objects.

The high bit in 0x80040165 is set, so this is a failure rather than a success or informational result. Its facility field is 4 (FACILITY_ITF) and its low 16-bit code is 357 (0x0165). Those bit fields classify the value, but they do not identify the failing object by themselves; the native method, object identity, and first producer of CS_E_NOT_DELETABLE remain essential.

Where it is raised

Understanding CS_E_NOT_DELETABLE requires this subsystem context: These CS_E values describe the legacy directory-backed COM Class Store. For CS_E_NOT_DELETABLE, public documentation is limited; the exact owner is the component performing automatic installation or directory lookup, so traces must identify that component rather than assigning the HRESULT to every modern COM activation path.

  • Associate CS_E_NOT_DELETABLE with one exact operation in automatic class installation or lookup through COM Class Store policy and directory-backed software-installation objects.
  • Confirm that CS_E_NOT_DELETABLE came from removing directory-backed software-installation metadata referenced by other objects, rather than from cleanup or a wrapper that ran afterward.
  • Preserve any IErrorInfo, underlying Win32 result, provider message, or callback failure that preceded CS_E_NOT_DELETABLE; the HRESULT alone should not erase a more specific cause.

Telemetry checklist

A useful CS_E_NOT_DELETABLE incident records the requested CLSID or ProgID, directory object DN, package identifier, version, deployment path, domain controller, schema version, policy state, bind result, and object size. For CS_E_NOT_DELETABLE, also retain the application and component build, architecture, process and thread IDs, COM apartment, operation correlation ID, elapsed time, and the first state-changing event before the failure. When logging CS_E_NOT_DELETABLE, redact content and credentials while preserving types, lengths, hashes, opaque identities, and lifecycle generations needed to reproduce its contract.

  • For CS_E_NOT_DELETABLE, enumerate inbound references and record their distinguished names.
  • For CS_E_NOT_DELETABLE, check package, policy, and class associations before deletion.
  • For CS_E_NOT_DELETABLE, perform the analysis on authoritative and replicated directory views.

Why this result is specific

  • CS_E_NOT_DELETABLE can result when packages, class mappings, or policy assignments still point to the object.
  • CS_E_NOT_DELETABLE can result when a staged upgrade creates a replacement but has not redirected every reference.
  • CS_E_NOT_DELETABLE can result when replication lag makes references appear inconsistent across controllers.

Investigation order

  1. Capture CS_E_NOT_DELETABLE at the first native return before a wrapper maps it to a generic exception.
  2. Identify the exact object, method, and lifecycle phase involved in removing directory-backed software-installation metadata referenced by other objects.
  3. Enumerate inbound references and record their distinguished names.
  4. Check package, policy, and class associations before deletion.
  5. Perform the analysis on authoritative and replicated directory views.
  6. Reproduce CS_E_NOT_DELETABLE with one controlled input or state change, and verify that the correction changes the decisive evidence rather than merely hiding the result.

Safe handling

Correction. For CS_E_NOT_DELETABLE, remove or migrate dependent references first, allow replication to converge, then delete the object through the supported administration path. Retry boundary. Retry only after dependencies are removed; forcing deletion risks orphaned deployment metadata. Before repeating the CS_E_NOT_DELETABLE operation, determine whether directory metadata, package staging, or a local installation changed before failure and avoid deleting a directory object whose ownership is not established.

Practical scenario

An administrator attempts to remove a package object still assigned by a software-deployment policy; unassigning the policy and waiting for replication preserves integrity. This isolates CS_E_NOT_DELETABLE within legacy COM Class Store and Active Directory software-installation metadata and provides a regression test for the stated correction.

Difference from related HRESULTs

CS_E_OBJECTNOTFOUND reports absence; CS_E_NOT_DELETABLE confirms the object exists but dependencies make deletion unsafe. For CS_E_NOT_DELETABLE, keep those outcomes separate in exception mappings, telemetry dimensions, user messages, and automated retry policy.

Developer and administrator guidance

For CS_E_NOT_DELETABLE, treat CS_E results as a legacy automatic-installation contract, preserve directory and policy diagnostics, and fall back to ordinary COM registration only when the product explicitly supports it. Regression coverage for CS_E_NOT_DELETABLE should include missing packages and classes, duplicate objects, malformed paths, version and schema mismatch, directory outages, administrative limits, and partial publication of metadata.

Operational repair for CS_E_NOT_DELETABLE must target the evidence-backed owner: involve the Active Directory or software-deployment owner, verify policy and domain-controller evidence, and use the management system that created the package or class-store object. Retain before-and-after traces for CS_E_NOT_DELETABLE so the change can be attributed and reversed.

References


Looking for a different code? Search another status or error code.