ERROR_CANNOT_IMPERSONATE - 1368 (0x558)
Unable to impersonate using a named pipe until data has been read from that pipe.
Updated: Feb 21, 2026
Technical Background
The ERROR_CANNOT_IMPERSONATE error code, with the numeric value of 1368 and the hexadecimal representation of 0x558, is encountered when attempting to impersonate a security context using a named pipe. This error indicates that the operation cannot proceed until data has been read from the specified named pipe.
Error Details
The ERROR_CANNOT_IMPERSONATE error code specifically pertains to scenarios where impersonation of a security context through a named pipe is attempted, but the necessary condition for such an operation—reading data from the pipe—is not met. This implies that the system requires data to be available on the pipe before it can proceed with the impersonation process.
Common Causes
- Invalid Parameter Values: The named pipe or security context provided might be invalid or improperly configured, leading to this error.
- Incorrect Object Type: The operation is being performed on an object that does not support impersonation through a named pipe.
- Exceeding Limits: There may be limitations imposed by the system or application that prevent impersonation until certain conditions are met.
Real-World Context
This error typically arises in scenarios where applications need to switch security contexts for specific operations, such as accessing resources on behalf of another user. Named pipes are often used in inter-process communication (IPC) to facilitate secure data exchange between processes running under different security contexts.
Is This Error Critical?
The criticality of this error depends on the context in which it occurs. If impersonation is a prerequisite for a specific operation, then encountering this error can halt the execution flow and may require corrective action before proceeding with the intended task.
How to Diagnose
To diagnose the issue, developers should:
- Review Operation Context: Ensure that all necessary parameters are correctly set up and that the named pipe is properly configured for impersonation.
- Validate Parameters: Verify that the security context and named pipe identifiers are valid and correctly specified in the application code.
- Confirm Object Types: Check that the object being impersonated supports impersonation through a named pipe. Some objects or processes may not support this operation.
How to Resolve
To resolve the issue, developers should:
- Correct Parameter Usage: Ensure that all parameters are correctly specified and that the named pipe is properly configured for impersonation.
- Adjust Operation Context: If necessary, adjust the context in which the operation is being performed to ensure that data can be read from the pipe before attempting impersonation.
- Restore Data: If data needs to be written to the pipe, do so prior to attempting impersonation. This ensures that the required condition for impersonation is met.
Developer Notes
Developers should be aware of the specific requirements and conditions under which named pipes support impersonation. Understanding these requirements can help in designing applications that handle security contexts more effectively.
Related Errors
ERROR_PIPE_CONNECTED(0x217): This error may occur if a connection to the pipe is not established before attempting impersonation.ERROR_BROKEN_PIPE(0x2E2): If the pipe is broken or closed, this error might be encountered instead ofERROR_CANNOT_IMPERSONATE.
FAQ
Q: What does the ERROR_CANNOT_IMPERSONATE error mean?
A: This error indicates that impersonation through a named pipe cannot proceed until data has been read from the specified pipe.
Q: How can I prevent this error from occurring?
A: Ensure that all necessary parameters are correctly set up and that data is available on the named pipe before attempting impersonation.
Summary
The ERROR_CANNOT_IMPERSONATE error code, 1368 (0x558), signifies a specific condition where impersonation through a named pipe cannot proceed until data has been read from the specified pipe. Understanding this error and its implications is crucial for developers working with security contexts in Windows applications that utilize named pipes.