Failed routing Example

This directory contains an example of failed capability routing in Component Framework.


If these components are not present in your build, they can be added by appending --with //examples to your fx set command. For example:

$ fx set core.x64 --with //examples
$ fx build


Use ffx component create to create the component instances inside a restricted realm for development purposes:

  • C++

    $ ffx component run /core/ffx-laboratory:echo_realm fuchsia-pkg://
  • Rust

    $ ffx component run /core/ffx-laboratory:echo_realm fuchsia-pkg://

Start the client component instance by passing its moniker to ffx component start:

$ ffx component start /core/ffx-laboratory:echo_realm/echo_client

When the above command is run, you can see the component framework error messages with fx log. The Echo protocol request fails due to a routing error:

[echo_client] WARNING: Required protocol `fidl.examples.routing.echo.Echo` was not available for target component `/core/ffx-laboratory:echo_realm/echo_client`:
`/core/ffx-laboratory:echo_realm/echo_client` tried to use `fidl.examples.routing.echo.Echo` from its parent, but the parent does not offer that capability. Note, use clauses in CML default to using from parent.

The Echo2 protocol request fails due to an issue starting the component:

[component_manager] WARN: Failed to start component `echo_server_bad#meta/`:
unable to load component with url "echo_server_bad#meta/":
error loading executable: "reading object at \"bin/routing_failed_echo_server_oops\" failed: A FIDL client's channel to the service (anonymous) File was closed: NOT_FOUND

After running the example, you can remove the example realm using ffx component destroy:

$ ffx component destroy /core/ffx-laboratory:echo_realm