crates/axed/src/errors.rs, and the variants in crates/axe/src/error.rs.
Engine errors
Every fallible engine call returnsaxe::Result<T>, whose error is axe::Error. The variant is the category to branch on; the message is for people.
gRPC status codes
Every gRPC API (axe.v1, process.v1, watcher.v1, ateenv.v1alpha) maps engine errors the same way. The message is the error’s display text.
Io errors map by errno:
Conflict becomes ALREADY_EXISTS in gRPC even when nothing “exists” in the usual sense, for example removing a non-empty directory without recursive.Reasons
The errors a client branches on carry agoogle.rpc.ErrorInfo in the status details (the grpc-status-details-bin trailer), with domain axe.v1 and a reason. Read it with your gRPC library’s rich error support: status.Details() in Go, tonic_types::StatusExt::get_details_error_info in Rust, grpc_status.rpc_status.from_call in Python. The code alone stays enough for clients that ignore details.
The adapters’ gRPC APIs carry the same details on the same errors; their clients may ignore them.
REST responses
The Agent Sandbox REST API returns errors as JSON withContent-Type: application/json:
The finer variants take their category’s row:
NameInUse and RequestIdConflict as Conflict, RequestExpired, ProcessExited and Frozen as FailedPrecondition, BudgetExhausted as ResourceExhausted, and LimitExceeded as InvalidArgument.
Io errors map by errno. Several replace the message with a fixed one, so host paths and kernel wording do not leak to clients:
gRPC and REST classify each errno the same way, but gRPC has no single code for
CONFLICT. EEXIST is ALREADY_EXISTS over gRPC, while ENOTEMPTY and EISDIR are FAILED_PRECONDITION. The fixed messages apply to REST only.Errors the REST layer adds
Errors the gRPC layer adds
These do not come from the engine.MCP
A tool that fails returns a result withisError: true and the error’s text as its content, for the model to read. It carries no gRPC code or reason. Protocol failures are JSON-RPC errors:
See Agents over MCP.
axectl
axectl prints a daemon error as axectl: <kind>: <message>, where <kind> names the gRPC code (not found, invalid argument, permission denied, failed precondition, already exists, unauthenticated, unavailable, resource exhausted, or error), followed by the reason in parentheses when there is one, as in axectl: already exists (NAME_IN_USE): .... It exits with 125. See axectl exit codes.
In Rust
Match on the variant:axe::Error::io(context, source) builds an Io error from a std::io::Error. Error implements std::error::Error, so ? converts it into Box<dyn std::error::Error>.
