zx_err_peer_closed indicates a failed attempt to read or write
from a peered Zircon object. Usually, this means that the remote side of the
peer is closed. This can occur for many different types of Zircon objects,
The error can also occur when failing to signal a peered object, such as
This document helps you troubleshoot the following causes
The following are potential causes of a
Incompatible FIDL protocols
zx_err_peer_closed error is thrown when
incompatible FIDL protocols are used between
the client and server, which closed the connection.
To remedy this, make sure your client and server are using the same FIDL protocols. See the FIDL language specification for more information on FIDL protocols.
The requested protocol is not defined in the component manifest
Similar to incompatible FIDIL protocols, if the requested protocol is
not defined in your component manifest, or
.cmx file, you will get a
Specifically, if you are using components v1, you will get a
in the following cases:
.cmx file requests a protocol that is not present in your realm. If
in the sys realm, this means the sysmgr config doesn't include the service.
.cmx file requested a protocol that is present in your realm, but
the component that is supposed to provide it is misconfigured and not actually
providing the protocol.
If this is the case, make sure your
.cmx file includes the protocol that you are requesting. You
fidlcat to help you diagnose the missing protocol.
For more information, see:
- Building components for more information on
- Fidlcat: Monitor and debug your fidl calls for more
- Component Realms for more information on realms.
A requested file cannot be accessed
zx_err_peer_closed error is thrown when you fail to open a file. This can happen for
the following reasons:
- You're attempting to open a file that doesn't exist
- You're trying to open a file that is requesting too many rights.
If this is the case, verify that you are requesting an existing file, or that the file and directory have the appropriate rights. You can learn more about directory rights and how they're specified.
Peer has crashed and the process has been terminated
If the peer crashes, the system processes the crash and terminates the process that generated
the error and all associated objects, leading to a
Adding epitaphs to errors as a component author
As a component author, it's important to help users get additional meaningful error messages
when they see the
zx_err_peer_closed error. To do this, your code should set
an epitaph with the
binding::Close(zx_status_t epitaph_value) binding.
See examples for setting meaninful epitaphs in //src/sys/appmgr/realm.cc.