What does macOS kernel return 0x10000012 (MACH_SEND_INVALID_CONTEXT) mean?

 
Previous Next
MACH_SEND_INVALID_TRAILER MACH_SEND_INVALID_RT_OOL_SIZE

MACH_SEND_INVALID_CONTEXT

The destination rejected the sender context associated with this send

MACH_SEND_INVALID_CONTEXT is distinct from a malformed port name or an invalid header. The current XNU definition states that the sending thread context did not match the context on the destination port. In other words, the message can be structurally valid while a kernel-enforced relationship between the sending thread and the destination still fails.

This is important for diagnosis because rewriting the payload does not repair a context mismatch. It also differs from a timeout: the send was rejected by a consistency check, not delayed behind a full queue. Keep the thread, port, and operation context together in diagnostics so a later trace can distinguish a stale or wrongly associated endpoint from a bad message layout.

What to inspect

  • Capture the destination port name, the calling thread, the message options, and the framework or subsystem that created the port.
  • Check handoff and lifecycle code that moves a request to another queue, task, or execution context before it is sent.
  • Do not collapse this result into MACH_SEND_INVALID_DEST; the latter identifies an invalid destination right, whereas this code reports a context mismatch.
  • Recreate the request through the owning API when possible instead of reusing a cached low-level port association.

References


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