Docs menu

Help

Help

Fixes for the refusals you'll meet, answers to common questions, and the words LayerFS uses.

Troubleshooting

A refused call throws a LayerFSError whose code says what happened. Look before you act: nothing is ever retried for you. Find the code below.

Unsupported Every fs, branch or project call fails.

Why: The process isn't on Linux, or the Store isn't on a local ext4, xfs or btrfs filesystem shared with the daemons.

Fix: Run your agent's process in a Linux container that mounts the Store's volume, or on macOS and Windows set LAYERFS_WORKER_ENDPOINT to the LayerFS home's worker. See Supported platforms.

InvalidInput A message naming LAYERFS_STORE_PATH or another missing setting.

Why: An environment variable is missing for this process. LayerFS reads only LAYERFS_* names, and takes no options object.

Fix: Set LAYERFS_STORE_PATH, LAYERFS_HOME, LAYERFS_DOCKER, LAYERFS_IMAGE, LAYERFS_VOLUME and LAYERFS_DAEMON, the same for every process of a run.

Exists LayerFS.init is refused.

Why: The project was already initialized in this LAYERFS_HOME.

Fix: Nothing to fix: use it. LayerFS.open(name) opens it.

Busy sandbox.create is refused.

Why: Another process held the project's lock for 60 seconds while it started a Sandbox.

Fix: Nothing was started. Stop and report; don't retry blindly.

NoSuchSandbox workspace.mount is refused.

Why: The Sandbox isn't running: it closed itself two minutes after its last Workspace was unmounted, or was closed.

Fix: Do what the message says: sandbox.create() a new one and mount there. A mount never starts a Sandbox.

Capacity workspace.mount is refused.

Why: The Sandbox already holds 16 Workspaces.

Fix: Create another Sandbox, or list its Workspaces with sandbox.list_workspaces and unmount the ones you're done with.

Failed sandbox.create fails with detail.removed.

Why: The container never became ready, for example a daemon that exits at startup. It has been removed.

Fix: Read detail.log (the last daemon log lines, also in the message) and fix the cause before creating again.

Unknown Every Sandbox start for the project is refused.

Why: An earlier start's outcome is unknown, so LayerFS won't risk a second one.

Fix: A person removes what the message names. Don't retry blindly.

Conflict A write or workspace.commit is refused.

Why: Someone changed the same path on the Branch first. Nothing was committed.

Fix: Read both sides. From a Workspace, fix the markers and commit again: see Merge and conflicts.

Dirty workspace.unmount is refused.

Why: The Workspace has changes that aren't committed; detail.changed lists them.

Fix: Commit them, so the step is recorded. Pass discard = true only to abandon them.

MountsActive sandbox.close is refused.

Why: A Workspace is still mounted in the Sandbox; detail.workspaces lists them.

Fix: Commit or discard, unmount every Workspace, then close. Or leave it: a Sandbox closes itself two minutes after its last unmount.

NoMatch fs.edit is refused (or AmbiguousMatch).

Why: oldText isn't in the file, or appears more than once.

Fix: Read the file as it is now, then include enough surrounding lines to match exactly once.

exec hangs workspace.exec doesn't return.

Why: It waits for everything holding its output, including background processes, and has no timeout.

Fix: Wrap commands in timeout and send a server's output to a file: node server.js >/tmp/server.log 2>&1 &.

stale view A Workspace doesn't show an fs write.

Why: A Workspace shows its Branch as it was at mount.

Fix: Mount a new Workspace to see it. The next Commit merges it in anyway.

To see what a daemon did, save its container's log before the Sandbox closes (backend.daemon.sandbox.get_log reads it too):

docker logs "$(cat "$LAYERFS_HOME/shop/sandboxes/1/container")" > daemon-1.log 2>&1

FAQ

Is the SDK on npm?

Not yet. @layerfs/agent, @layerfs/runtime and @layerfs/backend are folders of the LayerFS repository's api/ folder; link api/agent/sdk into your project. The install prompt has your agent do it.

Does LayerFS replace Git?

No. Your .git folder is part of the tree like any other file, so Git works inside a Workspace as usual. LayerFS records every step underneath it, including the files Git ignores.

Are ignored files and node_modules really saved?

Yes. Init captures everything, and a Commit saves everything in the Workspace. Repeated content is stored once, so many copies cost little.

Can agents on different machines share one Store?

Not today. Every process that opens a Store must share one Linux kernel and a local filesystem. Agents on one host, each in its own Sandbox, share it fine.

Does mounting copy my project?

No. A mount binds the committed tree and creates only the Workspace's small overlay database. Content loads as it's read.

Does LayerFS run or time out my commands?

workspace.exec launches bash -c in the container and returns its exit code and output. The LayerFS daemon only serves files; it doesn't supervise, time out, or commit for you.

Should I commit a failed step?

Yes. Commit after every Bash call with a message like "step 12: npm test (exit 1)", so the Branch shows what each step did. A step that changed nothing just answers UpToDate.

How do I undo a step?

Find the Commit before it with branch.list_commits and fork a new Branch from it. The bad step stays in history; nothing is rewritten.

Is my data safe if the machine loses power?

Not guaranteed. The Store runs without waiting for the disk, so a power loss or OS crash can lose recent history. See Durability.

Does Windows work?

Through WSL2. @layerfs/runtime runs the LayerFS home's worker in a WSL2 distribution with its own Docker Engine, and processes that name it with LAYERFS_WORKER_ENDPOINT send their Store calls there. Store calls never run natively on Windows.

Glossary

Branch
A named line of Commits where agents work. Forking one copies no files.
Commit
One saved change on a Branch: every fs write, every workspace.commit, every merge. Immutable.
Conflict
The refusal when two writes changed the same path. Nothing is committed.
daemon
The LayerFS process in each Sandbox. It serves Workspaces and opens the Store directly.
Disposable
The Store's one profile: SQLite WAL with synchronous=OFF. Durability is not claimed.
fork
Starting a Branch from a ref. Records where it starts; copies nothing.
Layer
One published state of main. Init makes main @ L0; each publish adds one.
/.lww
A file of gitignore-style patterns. Matching paths changed on both sides keep the newer version instead of conflicting.
main
The project's published line of Layers. Read-only; changes only by branch.publish.
merge base
The newest state both sides of a merge share; a three-way merge compares each side with it.
overlay
A Workspace's own small database of changes on top of the committed tree. Deleted at unmount.
project
One source tree under LayerFS, with its own Store.
publish
Making a Branch's Commit main's next Layer. It overwrites; merge main in first to keep others' work.
ref
What a read names: main, a Branch name, a Commit id or a Layer id.
Sandbox
A numbered container running one daemon, bound to one project and image. It holds up to 16 Workspaces, each mount naming it, and closes itself when idle.
Store
The one SQLite file holding all of a project's committed state, on a shared local volume.
UpToDate
The answer when a write changed nothing: no Commit is made.
Workspace
A complete, writable view of a Branch mounted in a Sandbox: { sandbox, path }, such as Sandbox 1 at /workspaces/2.