> ## Documentation Index
> Fetch the complete documentation index at: https://axe-engine.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Troubleshooting

> Symptoms you may see when running axed, what causes each one, and how to fix it.

axed logs to stderr as JSON by default. `--log-format text` is easier to read by eye, and `AXE_LOG=debug` adds detail such as failed accepts. `axectl info` shows whether axed is PID 1, whether it is a subreaper, and which cgroup it uses.

## Cgroups

### axed logs "cgroups unavailable"

At startup axed logs, at info level:

```text theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
cgroups unavailable; using process groups and rlimits
```

With the default `--cgroups auto`, axed tried to take over its cgroup and could not. It keeps running without cgroups, and `axectl info` shows `cgroup -`. The log line's `reason` field says why. The common ones:

| Reason | Cause | Fix |
| - | - | - |
| `cgroup v2 is not mounted in unified mode` | The system uses cgroup v1 or hybrid mode, so `/proc/self/cgroup` has no `0::` line. | Boot the host with cgroup v2 only. |
| `mkdir /sys/fs/cgroup/.../axed: Read-only file system` | The cgroup tree is mounted read-only, as in a default Docker container. | Give the container a writable cgroup v2 mount. |
| `mkdir ...: Permission denied` | axed's user cannot write its cgroup directory. The default image runs as user 1000. | Run axed as root, or delegate the cgroup to axed's user. |
| `cgroup ... is shared with other processes; run this process in its own cgroup or as PID 1` | Another process is in axed's cgroup, for example the init that `docker run --init` adds. | Make axed PID 1, or start it in a cgroup of its own. |

For local testing, a private cgroup namespace and a privileged container work:

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
docker run -d --name axed-cg --user 0 --privileged --cgroupns=private axe --cgroups required
```

`--privileged` gives the container broad access to the host, so use it only for testing. In Kubernetes, the container needs a writable, delegated cgroup v2 mount. [Containers and hosts](https://axe-engine.mintlify.site/deploy/containers.md#what-delegation-means) explains what axed needs.

### axed exits at startup with "cgroups required"

axed logs `axed exited with error` with an `error` field that starts with `cgroups required:`, and exits with status 1. `--cgroups required` makes the same attempt as `auto` but does not fall back. The text after `cgroups required:` is one of the reasons in the table above. Fix the cause, or use `--cgroups auto` if axed can do without cgroups.

### A controller is missing

axed logs a warning, `cgroup controller unavailable; limits that need it will fail`, with the controller's name in the `controller` field. axed enables the `cpu`, `memory` and `pids` controllers one at a time, and the kernel refused this one. Only limits that need it fail. A guest kernel built without the `cpu` controller enforces memory limits and refuses CPU limits. Check `/sys/fs/cgroup/cgroup.subtree_control` to see which controllers are enabled.

### CPU limits or Freeze fail with FAILED\_PRECONDITION

```text theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
axectl: failed precondition: CPU limits require cgroup v2 delegation
axectl: failed precondition: freezing processes requires cgroup v2 delegation
```

axed runs without cgroups, and CPU limits and `System.Freeze` have no fallback. Memory and task limits still work without cgroups, as rlimits. Give axed a delegated cgroup as described above, or drop the CPU limit and let the sandbox bound CPU for the whole sandbox.

### A memory or task limit behaves oddly without cgroups

Without cgroups, a memory limit becomes `RLIMIT_AS` and a task limit becomes `RLIMIT_NPROC`:

* `RLIMIT_AS` caps each process's virtual address space, not the tree's memory use. A runtime that reserves large address ranges up front can fail to start under a limit well above what it actually uses.
* `RLIMIT_NPROC` counts every process of the user, including ones axed did not start, so a process can hit it with few children of its own.
* The kernel does not apply `RLIMIT_NPROC` to root or to processes with `CAP_SYS_RESOURCE` or `CAP_SYS_ADMIN`, so a task limit does nothing for commands that run as root. Run them as another user with `--default-user`.
* OOM kills are never reported as `oom-killed`.
* A kill reaches the process group and every descendant axed finds through `/proc`. A descendant that moved to its own process group and whose parent has exited is no longer found, so it can survive the kill.

With cgroups, the same limits apply to the whole tree. See [Platform requirements](https://axe-engine.mintlify.site/reference/platform-requirements.md#without-cgroups).

## gVisor

gVisor offers no delegated cgroup hierarchy, so axed always runs without cgroups there.

* `--cgroups required` refuses to start. Use the default `auto`, which logs `cgroups unavailable` and continues, or `--cgroups off`, which skips the attempt.
* CPU limits and `axectl freeze` fail with `FAILED_PRECONDITION`. Let gVisor and the container runtime bound CPU and memory for the sandbox.
* Memory and task limits become rlimits, with the caveats [above](#a-memory-or-task-limit-behaves-oddly-without-cgroups).

You do not need `axectl resumed` after `runsc restore`. axed detects the resume from the clocks. See [gVisor](https://axe-engine.mintlify.site/deploy/gvisor.md).

## Firecracker and vsock

### Firecracker cannot open /dev/kvm

Firecracker needs read and write access to `/dev/kvm` on the host. Add your user to the group that owns it, or add a udev rule:

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
  | sudo tee /etc/udev/rules.d/99-kvm.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
```

The rule makes `/dev/kvm` accessible to every user on the host. On a shared machine, prefer the group.

### axed exits with "listen vsock://..."

axed binds every endpoint before it serves any, and a listener that fails to bind fails startup with status 1. For vsock, this means the guest kernel has no `AF_VSOCK` support, or the VM has no vsock device. Build the guest kernel with virtio vsock, and add the device before boot (`PUT /vsock` in Firecracker's API).

### axectl cannot connect to Firecracker's vsock socket

Firecracker exposes guest vsock as a Unix socket on the host, and a client must write `CONNECT <port>\n` and read `OK <n>\n` before the stream reaches the guest. `axectl` dials plain Unix sockets and does not perform this handshake. Put a proxy in between, such as [`tests/firecracker/vsock_proxy.py`](https://github.com/vincent0426/axe/blob/main/tests/firecracker/vsock_proxy.py), and point `AXE_ADDR` at the proxy's socket. [Firecracker](https://axe-engine.mintlify.site/deploy/firecracker.md#connect-from-the-host) has the full setup.

### Clients inside the guest cannot connect over vsock

A vsock listener with `?auth=none` refuses connections from inside the guest, over the loopback CID or the guest's own CID, so sandboxed code cannot reach a listener without a token. axed logs the refusal at debug level. Clients inside the guest need a listener that requires the token, or a Unix socket.

### Timeouts and the generation after a restore

Firecracker freezes the guest clocks across a snapshot, so axed does not detect the resume and the guest's wall clock falls behind. Timeouts stay correct. Run `axectl resumed` after every restore. It fails with `PERMISSION_DENIED: setting the clock needs CAP_SYS_TIME` when the clock is more than 50 ms off and axed lacks that capability, and then records no resume. See [Snapshots](https://axe-engine.mintlify.site/snapshots.md#after-a-restore-configure).

## PID 1 and orphans

`axectl info` shows how axed is running:

```text theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
pid1           false
subreaper      true
```

* **As PID 1**, axed reaps every orphan in the PID namespace, including processes it never started, such as orphans of a `docker exec`.
* **Not PID 1**, axed registers as a child subreaper, so orphaned descendants of the processes it starts still come back to it. Orphans from elsewhere go to whoever is PID 1. If that process does not reap, as with a shell script used as the entrypoint, zombies pile up outside axed's control. Make axed the entrypoint, or use an init that reaps.
* **`subreaper false`** while not PID 1 means the kernel refused the subreaper request. Orphaned descendants then go to PID 1 instead of axed.

axed stops its processes when it shuts down. If axed is killed with `SIGKILL` while not PID 1, the processes it started keep running under PID 1. When axed next takes over the same cgroup, it removes the per-process cgroups left by the earlier run and kills anything still in them. As PID 1, its exit makes the kernel kill everything left in the PID namespace.

Processes do not survive an axed restart. See [Design decisions](https://axe-engine.mintlify.site/design.md#scope).

## Authentication

### UNAUTHENTICATED or 401

```text theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
axectl: unauthenticated: missing or invalid bearer token
```

axed has a token configured and the call did not carry it. Every call needs it except REST `GET /v1/health` and `GET /readyz`, `grpc.health.v1`, and calls on listeners marked `?auth=none`. gRPC reflection needs it too, so `grpcurl list` fails without it.

* With `axectl`, set `AXE_TOKEN` or pass `--token`.
* Other clients send `Authorization: Bearer <token>` or `X-Sandboxd-Token: <token>`, as an HTTP header or gRPC metadata. MCP endpoints accept only `Authorization: Bearer <token>`.
* axed trims whitespace around the token in `--auth-token-file`. For `--auth-token-sha256`, hash the trimmed token: `printf %s "$(cat token)" | sha256sum`. Hashing the file directly includes any trailing newline and gives a different digest.

### "auth=none is not allowed on TCP listeners"

axed refuses `?auth=none` on `tcp://` listeners and exits at startup. Only Unix socket, vsock and `fd://` listeners can skip the token, because there the channel is the trust boundary. For TCP, configure a token. To keep a port on the local machine only, use `--listen-host 127.0.0.1` or a `tcp://127.0.0.1:...` listener.

### Permission denied on an auth=none Unix socket

A Unix socket with `?auth=none` is created with mode `0600`, so only axed's user can connect. Run the client as that user, or require the token on that listener.

### axed warns "no auth token configured"

axed has an open TCP port and no token, so anyone who can reach the port can run commands. Set `--auth-token-file` or `--auth-token-sha256`, or serve only Unix socket or vsock listeners and turn off the REST port with `--agent-sandbox=false`. See [Security](https://axe-engine.mintlify.site/deploy/security.md).

## Connections and descriptors

### Clients hang while connecting

axed caps open client connections at half its descriptor limit, between 16 and 65,536, split evenly among its `--listen` and `--mcp-listen` endpoints and the REST port. A connection beyond a listener's share waits in the kernel's accept backlog until another closes, so it looks like a slow connect, not an error. At startup axed raises its soft `RLIMIT_NOFILE` to the hard limit, so the cap follows the hard limit.

* Raise the hard limit where axed starts, for example `docker run --ulimit nofile=65536:65536`.
* Close idle connections. axed closes a gRPC connection with no call open after `--grpc-idle-timeout` (default `5m`), and REST connections idle or stalled for `--http-idle-timeout` (default `60s`).
* A gRPC client must send the HTTP/2 preface and first frame within 10 seconds of connecting, or axed closes the connection.

### EMFILE ("Too many open files")

The connection cap leaves the other half of axed's descriptor limit for processes and files. If axed itself runs out anyway, a call fails with `INTERNAL` over gRPC or 500 over REST, with the operating system's message, and failed accepts are retried after a short pause. Processes axed starts have their own descriptor tables. They get the soft limit axed started with, not the one axed raised for itself, unless the start request sets `open_files`, so a process that reports `EMFILE` hit its own limit, not axed's. Raise the hard limit as above. Failed accepts appear at debug level with `AXE_LOG=debug`.

### RESOURCE\_EXHAUSTED on a watch

```text theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
too many concurrent file watches (limit 64)
```

axed allows 64 concurrent watches across all APIs. Close watches you no longer need. A recursive watch on a tree larger than the kernel's inotify watch limit reports the subdirectories it could not cover and keeps watching the rest. See [Watch](https://axe-engine.mintlify.site/files/watch.md#the-shared-watch-limit).

## Output

### "N bytes of output were dropped"

```text theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
axectl: 1048576 bytes of output were dropped
```

The reader asked for bytes the log had already evicted. Each process keeps only its newest `--retain` bytes (default `1MiB`). A lossy reader that falls behind gets a gap event and continues at the oldest retained byte. `axectl logs` is always lossy.

* Raise retention for one process with `axectl run --retain` or `StartRequest.retain_bytes`, up to `--max-retain` (default `64MiB`), or raise the daemon default with `--retain`.
* Read losslessly. `axectl attach` without `--lossy`, `Run` and `axectl exec` never drop output. A lossless reader that stops reading blocks the process once retention is full.
* Read more often, and resume from the last offset you saw.

### A start fails with RESOURCE\_EXHAUSTED

```text theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
axectl: resource exhausted (BUDGET_EXHAUSTED): running processes hold the whole budget (3 processes, 3145728 output bytes reserved)
```

Every process reserves its full retention from `--output-budget` (default `256MiB`) and a slot from `--max-processes` (default `1024`). axed evicts finished records to make room, and refuses the start when running processes alone fill the budget or the slots. Lower per-process retention, raise `--output-budget`, or remove processes you no longer need with `axectl rm`.

A 65th lossless reader of one process fails with `RESOURCE_EXHAUSTED` too. Use a lossy reader for dashboards and tailing.

### Execute output is truncated

`Exec` and the Agent Sandbox `Execute` and `ExecuteWithLimits` buffer the whole output in the response. Each stream keeps at most 256 MiB, and all concurrent calls share `--capture-budget` (default `256MiB`). `Exec` and `ExecuteWithLimits` keep a prefix and set `stdout_truncated` or `stderr_truncated`. The plain `Execute` fails with `RESOURCE_EXHAUSTED`. For large output, start the process and read it with `Attach` instead. See [Output](https://axe-engine.mintlify.site/processes/output.md).

## Paths

### PERMISSION\_DENIED: path traversal outside sandbox root is forbidden

The path, or a symlink on the way, leads outside `--root-dir`. axed resolves every path one component at a time and follows a symlink only while its target stays inside the root. `axectl info` shows the root.

### The same path works over REST but not over gRPC

The APIs treat absolute paths outside the root differently:

| API | `/etc/passwd` with root `/workspace` |
| - | - |
| Native `Files`, native and Agent Substrate process `cwd` (strict) | Refused with `PERMISSION_DENIED` |
| Agent Sandbox REST, `WatchDir` and process `cwd` (lenient, as in sandboxd) | Taken as `/workspace/etc/passwd` |

An absolute path under the root, such as `/workspace/src`, works everywhere. Use paths relative to the root to get the same result on every API. See [Path confinement](https://axe-engine.mintlify.site/files/confinement.md#absolute-paths).

### INVALID\_ARGUMENT on a deep or looping path

axed refuses paths more than 256 directories deep and chains of more than 40 symlinks, or a loop:

```text theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
path is nested more than 256 levels deep
too many levels of symbolic links
```

Recursive list, copy, remove and watch are not bound by the depth limit.

## Tools

### pip, npm or git fails with "Permission denied" on /.local, /.npm or //.gitconfig

The process has `HOME=/`. In the default image, user 1000 has no entry in `/etc/passwd`, so nothing sets a home directory, and `/` belongs to root. Create the user with a home directory in your image, or set `HOME` in the request's environment. [Installation](https://axe-engine.mintlify.site/installation.md#the-default-image) shows both.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.