Skip to content

Troubleshooting

What usually goes wrong when an agent sandbox is set up, and what to do about it. Every error of fastsandbox derives from SandboxError, but for the misuse of the API (see Outside the hierarchy), and the command line prints it as fastsandbox: <message>; the Errors page lists them all.

Reaching the daemon

Symptom Cause What to do
DaemonUnavailableError Docker Sandboxes is not installed, its daemon does not run for this user, or its socket is elsewhere. Install Docker Sandboxes, and check that sbx version answers, as the same user. fastsandbox info prints the socket it tried; DOCKER_SANDBOXES_API names another one.
DaemonUnavailableError naming a socket that exists The socket belongs to another user: the daemon runs for one user, and only that user may open its socket. Run the program as the user who owns the daemon. Never widen the permissions of the socket: whoever opens it controls every sandbox of that user (see the security model).
UnsupportedVersionError The daemon runs an API version this release was not checked against: connect() and every task raise it. fastsandbox info connects anyway, warns sandboxd speaks API …, which this release of fastsandbox was not audited on (supported >=…, <…) on standard error and exits 0: its api line shows the version beside the range, maximum excluded. Upgrade fastsandbox, or sbx. To go on at your own risk, connect with connect(version_policy="warn"), which logs that warning on the fastsandbox logger, and give the client to the application, FastSandbox(client=...).
A warning the deletion of sandbox … or the removal of sandbox … failed, on the fastsandbox logger or that of a task The daemon could not remove the sandbox at the end of its block or of its run: it may stay. The error of the block, if any, went on, the failure noted on it. Remove the sandbox the warning names, by its identifier: see Failures and cleanup; sbx ls lists the sandboxes left.
Stopped sandboxes named after your tasks pile up Processes were killed (kill, a crash, a CI job cancelled) before their runs could remove their sandboxes. List them with sbx ls, check that no run still uses them, and remove them by identifier: see Failures and cleanup.
The first run waits for minutes The daemon pulls the image of the base kit, once; or a cache given the sbx CLI compiles the kit with it. Wait for the pull, which later runs skip; compile a kit only the CLI resolves ahead of time, fastsandbox kits compile ./kits/my-local-kit, for an application whose cache compiles with the CLI, FastSandbox(kits=KitCache(sbx="sbx")), which then takes the package from the cache on disk.
KitForgeError The base kit is one only the sbx CLI builds (a directory, a ZIP file, a Git repository), or the kit policy of the daemon forbids forging it. The default cache forges: it raises this for such a base kit, even one compiled ahead of time. Give the cache the CLI, KitCache(sbx="sbx") (FastSandbox(kits=KitCache(sbx="sbx")) for an application), or take a published kit.
InvalidKitError A kit is not named as sbx create names one (a name without a slash that is not an agent, a mixin that names no directory), a mixin is one only the CLI resolves (an image, a Git repository), or the forge refuses a kit argument, its value, or a mixin descriptor; a Mixin written in Python, Mixin.mcp() included, is checked, and refused, as it is made. Read kit and reason: how the CLI names kits, the values and the pattern the kit declares, or what the mixin may not declare. A mixin only the CLI resolves needs a cache given the CLI; a mixin forges once its spec.yaml is written in the JSON subset of YAML, or written in Python (Mixin).
A kit fails to compile The sbx CLI is not on PATH, for a cache that compiles with it. Install it with Docker Sandboxes; the cache needs it once per kit and sbx version.
A kit made from a registry or a Git repository is out of date The cache keeps a package while it suits the daemon, and does not see a base kit that moved since. Make it again with KitCache.refresh(client, kit), or empty the directory of the cache.

Running the agent

Symptom Cause What to do
TaskError: unknown agent The name is not one of the agents sbx knows, or is shell, which runs no prompt. Use the name of its kit: claude, codex, copilot, cursor, devin, docker-agent, droid, kiro, opencode.
InvalidSpecError: mounts: further mounts need a workspace The task has a Mounted input and no workspace, or a spec has mounts and no workspace: the daemon mounts further directories only beside a workspace, and refuses the creation otherwise. Give the task a WorkspaceDir input, for what it writes, or copy the data in with Uploaded (see Host paths).
The agent fails to authenticate Its key is not in the environment of the process that runs the task, so none was given; or no kit of the sandbox declares its service, and it was left out (ctx.lease.report.keys_left_out says so). Export the key in the shell that runs fastsandbox run; the agents page names the variable of each agent. Without one, the credential the daemon holds for the kit applies, a secret stored with sbx secret set for instance.
The agent fails to authenticate, without a key of its own The daemon withholds the credential the kit declares: the proxy injects nothing for it. A run logs it as a warning, the daemon withholds the credentials …, on the logger of the task. Export the key of the agent: it goes through the proxy whatever the daemon authorizes; with the client, Creation.created.withheld and the withheld of a push name what it withholds (see Withheld credentials).
TaskError: Claude Code exited with 1: Temp directory /tmp/claude-<uid> is owned by uid 0 The repository lives under /tmp/claude-<uid>, the directory Claude Code keeps its temporary files in: the sandbox recreates the path of the repository for its clone, as root, and Claude Code refuses a directory it does not own. Work on a repository outside /tmp/claude-<uid>.
The agent cannot reach its service The task refuses a host the agent needs, or the global policy of the daemon refuses it. A refusal that covers the host of a key fails the run before anything is created; read the activity log for the others.
A host answers HTTP 403 A rule denies it: the proxy answers in place of the host. Read the activity log of the run, and allow the host if the agent needs it.
InvalidSpecError A network rule of the task names a host in a form the sbx CLI refuses (a URL, a host with a path, a bare * or IPv6 address), a refusal covers the host of a key or of an MCP server, or a variable is set twice. Nothing was created. Write the host as the CLI takes it, api.example.com or api.example.com:443; narrow an HTTP rule to a path with path= (see The hosts a rule names). With the client, the same host raises InvalidRequestError.
LaunchError The sandbox was created, then failed to take its HTTP rules or its keys, or to start (its startup commands included): step says which. Its __cause__ is the error of the daemon. The sandbox is removed, unless kept says it stays: with keep=True, look inside it.
The agent does not get the tools of a server of the host The server, given in mcp=[McpServer.host(name, port)], does not serve streamable HTTP at /mcp on that port of the loopback, or refuses the token of the run. Serve on 127.0.0.1:<port>/mcp, and have the server accept the token ctx.mcp_token(name) gives, drawn for that run; inside the sandbox, the configuration of the agent shows what was registered, ~/.claude.json for claude.
SandboxTimeoutError The run went over the timeout of the task, or a command or the agent over its own, exec(timeout=...) or prompt(timeout=...): after is the deadline that expired. Raise that deadline, or stream the events of the agent to see where the time goes.
An agent or a command goes on after its deadline The deadline of exec() or prompt() ends the wait, not the process, which runs until its sandbox is removed. Let the run end, which removes the sandbox; see Timeouts and cancellation.
A sandbox reaches hosts its task does not allow Allow rules add to the global policy of the daemon; under the Open preset of sbx, every host is allowed already. A run logs it as a warning on fastsandbox.task.<name>, and ctx.lease.report.network.warning holds it. Deny the hosts it must not reach, or set sbx up with a preset that denies by default (see the network model).
CommandFailedError A command run with check=True exited with a non-zero code. Its exit_code, stdout and stderr say why.
pydantic.ValidationError, or fastsandbox: invalid inputs of task … from the command line The inputs do not match the signature of the task, or the result its return annotation. The message names the field, or the option on the command line; for inputs, nothing was created.

Where the work went

Symptom Cause What to do
Files of your repository changed WorkspaceDir() mounts your directory read-write. Use WorkspaceDir(clone=True), and take the work back as a patch (see Working with repositories).
The work of the agent is gone A clone and an upload go with the sandbox. Return what you keep from the task: a patch, a file, a report. To look at what was left, keep the sandbox with keep=True.
A sandbox created with the client stops A sandbox stops about 30 seconds after its last session. Work in it inside async with sandbox.running(): (see Sessions).

Testing

Symptom Cause What to do
A test against the fake daemon gets HTTP 501 SSH tunnels upgrade the connection to an SSH server, which the fake daemon does not fake. Add the route of the tunnel to the fake, with the bytes it gives, or test an SSH session against the real daemon (see Testing).

Looking inside

When the cause is not in this list, keep the sandbox of a run with keep=True, then open a shell in it:

ssh -o ProxyCommand="fastsandbox ssh-proxy NAME" agent@NAME

and delete it when you are done. To report a bug, open an issue with the output of fastsandbox info and the smallest task that shows it.