| Previous | Next |
| ERROR_RESTART_APPLICATION | ERROR_AUTHIP_FAILURE |
ERROR_WRONG_COMPARTMENT
The request used the wrong Windows routing compartment.
ERROR_WRONG_COMPARTMENT is Win32 error 1468 (0x5BC). Windows networking can isolate routing and interface state into compartments. A socket or connection request made while the calling thread, process, or supplied interface belongs to another compartment may be unable to use the expected route even though the address is reachable elsewhere on the same computer. This is particularly relevant to container, virtualization, service-hosting, and advanced network-management code.
Common sources of compartment mismatch
- a worker thread inherited or retained a compartment selected for a previous request
- an interface index or route was discovered in one compartment and used in another
- container or host networking context was confused during socket creation
- asynchronous work resumed on a thread whose network compartment differs from the initiator
- diagnostic code checked only the default routing table and missed isolated network state
Telemetry that exposes the mismatch
Record the local and remote addresses, protocol, socket creation point, interface LUID and index, route selected, process and thread IDs, container or silo identity, and the compartment IDs associated with discovery and connection. Log when compartment context is changed and restored. A normal route printout from the host default compartment is not enough evidence for a request made inside another one.
Diagnostic approach
Reproduce in the same service account, session, container, and networking topology. Enumerate interfaces and routes in the context where the connection is actually created. Compare that context with the one used to resolve names, select source addresses, bind, and connect. A valid interface index is not globally interchangeable across isolated routing views.
Review thread-pool and callback boundaries. If code temporarily changes thread networking context, use a scope that restores the previous state on every return and exception path. Avoid passing compartment-specific route or interface data to generic workers without carrying the corresponding context explicitly.
Corrective design
Create and use the socket in the intended network context, or dispatch the entire operation to a component that owns that compartment. Re-resolve route and interface information after entering the correct context. Do not fix the symptom by adding host-wide routes unless the isolation design actually requires them; that can weaken container boundaries and still leave the application race unresolved.
Difference from ordinary reachability errors
ERROR_NETWORK_UNREACHABLE says no usable path was found in the routing view used by the request. Error 1468 is more specific: the caller selected or inherited the wrong routing compartment. Firewall, DNS, and remote-host diagnostics should follow only after the local context is verified.
Example
A management service enumerates a container interface, queues a connect operation, and later runs it on a host-context thread. The saved interface index exists but belongs to the container compartment. The connection returns 1468. Performing discovery and connect within one explicit compartment scope fixes the request without changing routes.
References
- Microsoft: System Error Codes (1300–1699)
- Microsoft: GetCurrentThreadCompartmentId
- Microsoft: SetCurrentThreadCompartmentId
Looking for a different code? Search another status or error code.
