Scenario

A read-only database on a read-write mount

L3SeniorIncident25 minDebuggingSystem design

RolesAgent Systems EngineeringCustomer AI Deployment

Engine
sbx v0.47.0 and docker-agent v1.149.0 on the host, with the main build of docker-agent inside the template
Model
none; the run stopped before its first model call
Hardware
one Mac with the microVM runtime

Situation

A team runs its coding agent with --sandbox, so that its shell and filesystem tools act inside a microVM while the model stays on the host. The first sandboxed run on a developer's Mac prints a launch summary, pulls the template image, creates the sandbox, and exits with code 1 before the agent answers. The error names the session store: its migration could not create a table, because the database was read-only. The sandbox is still listed as running.

The team splits three ways in the channel. One engineer says the template image is broken and wants to pin an older tag. One says the workspace must have been mounted read-only by mistake. One says SQLite is missing from the guest. Before the second attempt, the developer gives you the launch output, a second run with the state directories at their defaults, and a shell inside the running VM.

Questions

  1. Where did the data directory sit, and which mount held it?
  2. Three mounts are read-only in the summary. Does any of them explain the error?
  3. What does the SQLite probe add that the error message does not?
  4. Why did the second run fail before it created anything?
  5. The last listing is a run that completed. What does it prove, and what does it not prove?
  6. How would you run this agent in a sandbox on this host today, and what would you file?

Commit to a cause after each listing. Write it down before you read the next one.

Evidence

1/7

the sandboxed run, its state flags and the launch summary

Read the note after the command for where the three state directories sit, then the four workspace lines and their modes.

evidence/the-command-and-its-mounts.txt
$ docker-agent run --sandbox --exec --working-dir fixtures/repo-sandbox fixtures/agents/files-sandbox.yaml 'List the files in the working directory and count the lines of README.md.'  (--config-dir, --data-dir, --cache-dir under fixtures/repo-sandbox/.m101, inside the workspace)
Models gateway: none configured
Models catalog: allowlisting models.dev in the sandbox proxy
User sandbox allowlist: allowlisting 1 host(s) from `docker agent sandbox allow`:
  - localhost:12434

sandbox    docker-agent-<hash>
agent      docker-agent
workspace  $CAPTURE/fixtures/repo-sandbox (rw)
           $CAPTURE/fixtures/agents (ro)
           $CAPTURE/fixtures/repo-sandbox/.m101/cache/sandbox-kits/<hash> (ro)
           $CAPTURE/fixtures/repo-sandbox/.m101/cfg (ro)
image      docker/docker-agent-sbx-templates:latest
cpu        10
memory     32 GiB

Source: manuals/docker-sandboxes-101/capture/out/27-sandbox-run.txt, lines 1-15

2/7

the last five lines of the sandboxed run

The run ends at the session store, before any model call.

evidence/the-error-that-ended-the-run.txt
<ts> WARN Self-update skipped; continuing with current binary error="current version \"main\" is not a release version: invalid semantic version"
docker-agent: self-update failed (current version "main" is not a release version: invalid semantic version); continuing with current version
Error: creating session store: migration failed even after database reset: failed to create migrations table: attempt to write a readonly database (1032)
Error: 
[exit 1]

Source: manuals/docker-sandboxes-101/capture/out/27-sandbox-run.txt, lines 24-28

3/7

the same run with the state directories at their defaults

One line names the rule for the data directory.

evidence/a-data-directory-outside-the-workspace.txt
$ docker-agent run --sandbox --exec --working-dir fixtures/repo-sandbox fixtures/agents/files-sandbox.yaml 'List the files in the working directory and count the lines of README.md.'
Error: --data-dir must be inside the sandbox's writable workspace $CAPTURE/fixtures/repo-sandbox
[exit 1]

Source: manuals/docker-sandboxes-101/capture/out/27-data-dir-outside.txt

4/7

a plain SQLite write inside the VM, then the mounts of the workspace

Compare the error with the mode letters of the first mount.

evidence/a-sqlite-write-and-the-mounts.txt
$ sbx exec docker-agent-<hash> sh -c 'cd "$PWD" && mkdir -p .m101/probe && python3 -c '"'"'import sqlite3; c = sqlite3.connect(".m101/probe/x.db"); c.execute("create table t(a)"); c.execute("insert into t values (1)"); c.commit(); print("sqlite write ok")'"'"' 2>&1 | tail -1; mount | grep repo-sandbox'
sqlite3.OperationalError: attempt to write a readonly database
host on $CAPTURE/fixtures/repo-sandbox type virtiofs (rw,nosuid,nodev,relatime)
host on $CAPTURE/fixtures/repo-sandbox/.m101/cache/sandbox-kits/<hash> type virtiofs (ro,nosuid,nodev,relatime)
host on $CAPTURE/fixtures/repo-sandbox/.m101/cfg type virtiofs (ro,nosuid,nodev,relatime)
[exit 0]

Source: manuals/docker-sandboxes-101/capture/out/27-sqlite-probe.txt

5/7

the auto-kit that docker-agent staged under the workspace

The manifest has two fields and nothing about a database.

evidence/what-the-staged-kit-holds.txt
$ find fixtures/repo-sandbox/.m101/cache/sandbox-kits -maxdepth 3 | sort
fixtures/repo-sandbox/.m101/cache/sandbox-kits
fixtures/repo-sandbox/.m101/cache/sandbox-kits/<hash>
fixtures/repo-sandbox/.m101/cache/sandbox-kits/<hash>/manifest.json
fixtures/repo-sandbox/.m101/cache/sandbox-kits/<hash>/prompt_files
fixtures/repo-sandbox/.m101/cache/sandbox-kits/<hash>/skills

$ cat fixtures/repo-sandbox/.m101/cache/sandbox-kits/<hash>/manifest.json
{
  "agent_ref": "$CAPTURE/fixtures/agents/files-sandbox.yaml",
  "built_at": "<ts>"
}

Source: manuals/docker-sandboxes-101/capture/out/27-kit-cache.txt

6/7

the version of the agent binary inside the VM

The template does not run the release that the host runs.

evidence/the-agent-binary-inside.txt
$ sbx exec docker-agent-<hash> sh -c 'docker-agent version; echo; env | grep -iE '"'"'proxy|gateway|models|safety|yolo'"'"' | sort; echo; docker-agent sandbox list'
docker-agent version main
Commit: 154b78f2d517dae1397866dfb7586c4a302a3151

Source: manuals/docker-sandboxes-101/capture/out/27-inside.txt, lines 1-3

7/7

the same agent file started by hand inside the VM

Read the three state flags in the command, then the answer.

evidence/the-run-that-worked-inside.txt
$ sbx exec docker-agent-<hash> sh -c 'docker-agent --config-dir /tmp/m101 --data-dir /tmp/m101 --cache-dir /tmp/m101 run --exec --last --working-dir $CAPTURE/fixtures/repo-sandbox $CAPTURE/fixtures/agents/files-sandbox.yaml '"'"'List the files in the working directory and count the lines of README.md.'"'"''
<ts> WARN Self-update skipped; continuing with current binary error="current version \"main\" is not a release version: invalid semantic version"
docker-agent: self-update failed (current version "main" is not a release version: invalid semantic version); continuing with current version
The working directory contains README.md with 1 line.
[exit 0]

Source: manuals/docker-sandboxes-101/capture/out/27-inside-run.txt

The answer

Show the walkthrough
  1. Read the state flags first. The note after the command says that the config, data and cache directories sit under .m101/ in the workspace. The error comes from the session store, which lives in the data directory, so the database file is on the workspace mount.
  2. Read the four workspace lines. The workspace is (rw). The agent file directory, the staged kit under .m101/cache/sandbox-kits/<hash> and .m101/cfg are (ro). The data directory is none of those three paths, so the mount modes do not explain the failure.
  3. Rule out the mount flags with the probe. Inside the VM, a plain Python sqlite3 write under .m101/probe/ fails with the same attempt to write a readonly database message. The mount table on the lines below lists the workspace as a virtiofs mount with rw. The kernel reports the mount as writable, and SQLite still cannot write a database through it. The fault sits between SQLite and this mount, not in the sandbox settings and not in a missing package: the probe imported sqlite3 and connected without error.
  4. Read why the defaults are no escape. The run with the default state directories was refused before it made a sandbox: --data-dir must be inside the writable workspace. So the launcher forces the database onto the one mount where, on this host, SQLite cannot write it.
  5. Separate the kit from the store. The staged auto-kit holds a manifest.json with agent_ref and built_at, plus prompt_files and skills. Nothing in it configures a database. The template runs docker-agent version main, not the release the host runs, so the image tag is a second finding to record. The probe fails for any program, though, so a different agent build would not change the result.
  6. Prove the model path with the run by hand. Started inside the VM with its three state directories under /tmp/m101, the guest's own filesystem and not a mount, the same agent file answered with exit 0: the README has 1 line. The provider at host.docker.internal:12434 was reached through the proxy. So the model path, the allowlist and the agent file are sound. Only the location of the session store fails.
Show the resolution

The session store could not write because SQLite cannot write a database through the virtiofs workspace mount on this host, although mount lists it as rw. The launcher requires the data directory inside that workspace, so a --sandbox launch has no supported place for the store on this machine. The sandbox itself worked: a run started by hand inside the VM, with its state under /tmp/m101, completed with the correct answer, and the same agent file reached the model through the proxy.

What to do:

  1. On every new host, before the launcher is used with --sandbox, test a SQLite write inside the workspace from a shell in the VM, as the manual's checklist says.
  2. Until the data directory rule changes, start the agent inside the VM by hand with sbx exec, with --data-dir on the guest filesystem, and keep the host launcher for machines where the probe passes.
  3. Remove the sandbox with sbx rm when you are done, because the launcher leaves it running after the error.
  4. File two open items: the template runs the main build and not the pinned release, and the run printed no safety mode, so the mode a sandboxed run uses stays unknown, which is conflict C62 in the manual.
Show the wrong turns
  • “The workspace was mounted read-only.”

    The summary lists it as rw, and the mount table inside the VM agrees. The three read-only mounts are the agent file directory, the staged kit and the config directory, and the database is under none of them.

  • “Pin an older template tag.”

    The probe fails for a plain Python script with no agent involved, so the agent build is not the cause. The main build is worth a ticket, not a fix.

  • “Move the data directory to the host default.”

    The launcher refuses a data directory outside the writable workspace, before it creates anything.

  • “SQLite is missing from the guest.”

    The probe imported the module and opened the database. It failed on the first write.

Show the general rule

When a program reports a permission error on a path that the system lists as writable, repeat the operation with the smallest program that performs it, on the same path, outside the product. A failure there moves the fault from the product's settings to the layer under it, and a pass narrows it to the product. Then check whether the product gives you a way around that layer, and if it does not, write down the exact rule that blocks you.

Taught in

The manual's end to end run records this failure and the probe, the run page explains the state flags, and the conflicts register keeps conflict C62 open.