| Previous | Next |
| ERROR_DYNAMIC_CODE_BLOCKED | ERROR_STRICT_CFG_VIOLATION |
ERROR_NOT_SAME_OBJECT
The compared references resolve to different objects.
ERROR_NOT_SAME_OBJECT is Win32 error 1656 (0x678). The code is returned when an operation requires identity equality but Windows resolves the supplied references to different underlying objects. Equality cannot always be inferred from text: path aliases, hard links, reparse points, case handling, object namespaces, snapshots, file replacement, and reopened handles can make names look related while object identity differs.
Why identity comparisons fail
- two paths point to different files despite similar or normalized text
- a file was atomically replaced after one handle was opened
- a reparse point, mount point, or symbolic link resolves through a different target
- handles originate from different namespaces, containers, volumes, or object lifetimes
- the caller compares cached metadata with an object that has since been recreated
Identity evidence to capture
Record both original references, normalized final paths, volume identifiers, file or object IDs when the API exposes them, handle open times, share and access flags, reparse information, namespace or partition identity, and the exact comparison API. Avoid treating path strings as secrets-free: user names and business document names may require redaction.
Diagnostic sequence
Keep both handles open while collecting identity information so the objects cannot change between checks. For files, compare volume serial and persistent file identifiers rather than only names. Resolve final paths and inspect reparse tags, but remember that final path text still may not be the authoritative identity key for every object type.
Review races involving rename, replace, delete, snapshot switch, or container remapping. If the operation crosses processes, verify that duplicated handles and protocol identifiers refer to the intended object generation. Reproduce with file-system and object-manager tracing when timing is significant.
Corrective action
Use the same validated handle throughout the transaction, or reopen and revalidate both references immediately before the identity-sensitive operation. Abort safely if identity changed; do not force the operation merely because the names are similar. For persistent workflows, store stable identifiers together with volume or namespace context.
Developers should define whether their contract requires same name, same current target, or same underlying object. Those are different predicates. Logs should state which predicate failed so operators do not “fix” aliases that are working as designed.
Difference from not found and invalid handle
A not-found result means the target cannot be resolved, and an invalid-handle result means a handle is unusable. Error 1656 means both references were sufficiently valid to compare, but identity equality required by the operation was false.
Example
A backup service opens a source file, then another process replaces the pathname with a new file. Before committing metadata, the service reopens the path and receives 1656 when comparing identities. It discards the stale transaction and restarts from the new file instead of attaching old metadata to new content.
References
- Microsoft: System Error Codes (1300–1699)
- Microsoft: GetFileInformationByHandleEx
- Microsoft: GetFinalPathNameByHandle
Looking for a different code? Search another status or error code.