| Previous | Next |
| KERN_INVALID_NAME | KERN_INVALID_RIGHT |
KERN_INVALID_TASK
KERN_INVALID_TASK means the target supplied to a Mach operation is not an active task. In Mach terminology, a task owns resources such as a virtual address space and a port-right namespace; it is related to, but not identical with, a running thread or a POSIX process.
A task port obtained earlier does not guarantee that the target remains usable forever. The task can terminate or the operation can receive a stale or inappropriate task reference. This result therefore points first to object lifetime and target selection, not to the memory address or IPC message contents that may have been passed alongside it.
Diagnostic questions
- Was the task still active when the call began?
- Did the code retain and release the task reference according to the API contract?
- Could an exit, exec-like replacement, debugger detach, or teardown race invalidate the target?
- Is the caller confusing a task port with a thread port, host port, or an ordinary Mach port?
For operations against another process, log the target identity and the point at which its task port was obtained. That makes a stale-target failure distinguishable from a failure inside the requested VM or IPC operation.
References
- XNU: kern_return.h
- Apple Kernel Programming Guide: Mach ports and rights
- GNU Mach Reference Manual: Port Manipulation Interface
Looking for a different code? Search another status or error code.