Matching errors
Spawn-time exec failures
exec() distinguishes between:
A program that ran and exited non-zero: the call returns an ExecOutput with a non-zero code. This is not an error in the SDK sense; it’s a normal result.
A program that never started: the binary doesn’t exist, isn’t executable, the working directory is unreachable, etc. The call returns or raises an SDK error.
Structured spawn-failure details
Structured spawn-failure details
See Rust failure kinds and Go execution failures for structured payloads. The handling examples above show how to inspect them.
127 for NotFound, 126 for PermissionDenied and NotExecutable, and 1 otherwise.
Name conflicts
Creating a sandbox with a name that’s already in use (and withoutreplace) surfaces a typed error. Branch on it to decide how to recover, such as resuming the existing sandbox or regenerating the name.
connect_or_create and its language-specific equivalents to reuse the existing sandbox without changing its configuration. Pass replace() / replace=True / replace: true / --replace / WithReplace() only when you intend to stop the existing sandbox and create a new one. See Naming conflicts for the grace-period setting.
When a sandbox object is stale
ASandbox or SandboxHandle keeps the ID of the exact sandbox it represents. If that sandbox is removed and the name is reused, lifecycle methods refuse to act on the replacement and return a typed error.
Stop observation timeouts
On Local, a graceful-stop timeout causes the SDK to force-kill the sandbox. On Cloud, the same timeout only limits how long the SDK waits: the accepted server-side stop is not cancelled and may still complete. Cloud reports this withSandboxStopTimedOutError in TypeScript and Python, Error::SandboxStopTimedOut in Rust, and ErrSandboxStopTimedOut in Go. Ruby currently raises Microsandbox::Error with a message explaining that the accepted stop may still complete.
After a Cloud timeout, poll the sandbox status or call the wait-until-stopped method if you still need confirmation. Calling request_stop first is useful when the application wants to submit the stop and control its own observation deadline.
Modification not confirmed
On Cloud, amodify apply that did not complete as asked fails with ModificationNotConfirmedError in TypeScript and Python, MicrosandboxError::ModificationNotConfirmed in Rust, and ErrModificationNotConfirmed in Go. The change may be saved without being in effect on the running sandbox, or its result is unknown. The message reads the change did not complete as asked: <cause>, where the cause says which is known and, when sending the same change again retries it, says so. If another change arrived in between, the resend overwrites it.
A running or failed Cloud sandbox answers each live change with live or this error. A change reads next start only when the sandbox is stopped or the next-start policy is used. Until the server knows the result, usually within seconds, starting the sandbox is refused. Local sandboxes never return this error.