| Previous | Next |
| ERROR_MEMBERS_PRIMARY_GROUP | ERROR_NO_SUCH_ALIAS |
ERROR_TOKEN_ALREADY_IN_USE
A primary-token assignment attempted to reuse a token object in an incompatible ownership state
Primary tokens represent process security contexts, while impersonation tokens represent thread-level impersonation. This status specifically mentions a token already in use as a primary token. It is therefore not equivalent to ERROR_BAD_TOKEN_TYPE: the token type may be primary as required, but the same token object is already committed to a primary-token use that conflicts with the requested assignment.
Trace where the token handle originated and which process or token-assignment operation already uses it. Query TokenType and TokenStatistics, then inspect duplication semantics. If a distinct primary token object is needed, use DuplicateTokenEx with the correct token type and access rights rather than sharing an object whose lifecycle is already bound to another primary-token use. Be careful with handle duplication: duplicating a handle to the same token object is not the same as creating a new token object.
What to inspect
- Query TokenType and token statistics for the supplied handle.
- Identify the process or operation that already uses the token as primary.
- Create an appropriate duplicated token object; do not merely duplicate the handle.
References
Looking for a different code? Search another status or error code.