Errors
The SDK reports failures as VMError, exported from @oxvm/sdk. Promise-based methods reject with it; synchronous ones, such as vm.workspace.watch, throw it.
class VMError extends Error { readonly code: VMErrorCode; readonly detail: Readonly<Record<string, unknown>> | undefined; constructor(code: VMErrorCode, message: string, detail?: Readonly<Record<string, unknown>>);}| Member | Meaning |
|---|---|
code |
One of the fifteen stable VMErrorCode values. |
detail |
Optional structured context. detail.reason, when present, is a stable string that narrows the cause. See Reasons. |
message |
A human-readable explanation for logs. Its wording is not stable. |
name |
Always "VMError". |
Test with error instanceof VMError.
import { createVM, VMError, type UserspaceOptions, type UserspaceVM } from "@oxvm/sdk";
export async function openProject(options: UserspaceOptions): Promise<UserspaceVM> { try { return await createVM({ ...options, restorePoint: "latest" }); } catch (error: unknown) { if ( error instanceof VMError && error.code === "PROTOCOL_ERROR" && error.detail?.["reason"] === "image-trust-changed" ) { // Saved on an image signed by another key: move it to the configured image, keeping /workspace. return createVM({ ...options, restorePoint: "update-image" }); } throw error; }}| Code | Typical cause | What to do |
|---|---|---|
ABORTED |
An AbortSignal you passed fired, or the VM was disposed while the operation ran, for example during a workspace watch. |
Treat it as a cancellation. |
CORE_LOAD_FAILED |
A self-hosted engine’s files at runtime.baseUrl could not be downloaded or differ from the release the SDK pins (detail.asset names the file, detail.status a failed HTTP status), the browser lacks a required WebAssembly or JavaScript feature (detail.reason: "browser-unsupported"), or a module’s pinned file could not be downloaded (detail.reason: "wasm-module-artifact"). |
Self-hosted, stage the engine again with oxvm assets install, serve .wasm as application/wasm, and check the page with oxvm doctor. For a module, run oxvm wasm stage and check that your page serves its staged files. |
FEATURE_NOT_AVAILABLE |
Something this call needs is missing in the browser, the image, the mode or your configuration. | Read detail.reason, then fix the configuration or hide the feature. |
GUEST_CRASH |
The guest failed in a way the SDK cannot recover from, for example a restored guest agent that does not answer (agent-unavailable). |
Dispose the VM and create a new one; offer a cold start with restorePoint: "none". |
INVALID_ARGUMENT |
An option, path or argument failed validation, or a backup file was refused. | Fix the call. This is a caller error. |
PERMISSION_DENIED |
The browser refused storage access or the Service Worker of a preview, a workspace entry is not accessible, a relay refused the user or the destination, or a public runtime has no license token that admits this page (license-required, license-invalid). |
Ask for the needed permission, check the relay’s policy, or see Licenses. |
PROTOCOL_ERROR |
A runtime or wire fault: a call on a disposed VM, an image manifest that could not be downloaded or verified, an image signed by another key, or assets that do not match the installed SDK. | Check that the staged assets match the installed SDK; for key changes see image-trust-changed and untrusted-key below. |
QUOTA_EXCEEDED |
Browser storage is full, exec output passed maxOutputBytes (detail.maxOutputBytes), or a relay quota was reached. |
Free space, for example by deleting restore points; raise maxOutputBytes or stream with spawn. |
RELAY_ERROR |
A relay connection failed, and detail.reason names the relay failure; or the Service Worker of a preview failed to start or could not be reached. |
For a relay, show the reason and let the user retry vm.network.connect. For a preview, see Previews. |
SNAPSHOT_VERSION |
A restore point or backup uses a format this SDK cannot read. | Use the SDK that wrote it, or start without it. |
STORAGE_ERROR |
A workspace or browser storage operation failed. | Branch on detail.reason. |
STORAGE_NOT_FOUND |
A workspace path, a restore point or a stored image does not exist. | Check the path or reference; for images see image-not-cached and base-missing. |
UNSUPPORTED_INSTRUCTION |
The guest executed an x86-64 instruction or CPU feature that the engine does not implement. | Report it with the program that triggered it. |
UNSUPPORTED_SYSCALL |
Execution reached a system call path that the engine does not handle. | Report it with the command that triggered it. |
VM_FAULT |
The engine hit an internal execution fault, or a command failed without a more specific error. | Dispose the VM, create a new one, and report it. |
VMErrorCode is the union of these fifteen strings.
Common detail fields
Section titled “Common detail fields”| Field | Appears with | Meaning |
|---|---|---|
reason |
many codes | A stable cause. See Reasons. |
cleanupFailed |
the original code | true when cleaning up after the failure also failed, for example after a failed createVM or an aborted exec. |
cleanupError |
with cleanupFailed |
The cleanup failure as { code, message, detail? }. |
maxOutputBytes |
QUOTA_EXCEEDED |
The output limit exec enforced. |
size |
STORAGE_ERROR with too-large |
The size of the file or write, in bytes. |
keyId |
PROTOCOL_ERROR with untrusted-key or image-trust-changed |
The key ID involved. |
missing |
CORE_LOAD_FAILED with browser-unsupported |
The missing browser features: "wasm-simd", "wasm-tail-calls", "promise-with-resolvers". |
capability |
FEATURE_NOT_AVAILABLE with wasm-module-isolation-unavailable |
The module isolation check that failed. |
file |
wasm-module-integrity, wasm-module-artifact |
The module file that did not match or could not be downloaded. |
requirement |
FEATURE_NOT_AVAILABLE with browser-unsupported |
"cross-origin-isolation" when a page that uses the runtime frame is not cross-origin isolated. |
rejected |
PERMISSION_DENIED with license-required or license-invalid |
Why the engine refused the license token: a LicenseRejection, or null when it reports none. |
errno |
Userspace workspace errors without a named reason | The Linux error number. |
Reasons
Section titled “Reasons”Browser and configuration
Section titled “Browser and configuration”detail.reason |
Code | Meaning |
|---|---|---|
browser-unsupported |
FEATURE_NOT_AVAILABLE |
The browser has no module workers, or a page that uses the runtime frame is not cross-origin isolated (detail.requirement: "cross-origin-isolation"). |
browser-unsupported |
CORE_LOAD_FAILED |
The browser lacks a required feature; detail.missing lists it. See Browser requirements. |
release-gate-open |
FEATURE_NOT_AVAILABLE |
System vcpus other than 1. |
not-configured |
FEATURE_NOT_AVAILABLE |
exposePort on a VM created without preview. |
image-unsupported |
FEATURE_NOT_AVAILABLE |
The image’s guest integration lacks the operation, for example terminal resize or interrupt, or the requested signal. |
Licenses
Section titled “Licenses”Browser storage refusals use PERMISSION_DENIED with
detail.reason: "browser-storage-blocked". This is separate from license
validation. Allow site storage for the application and runtime origin, then
retry. The SDK cannot change browser privacy settings. It does not replace
durable storage with temporary memory.
The engine checks runtime.license at new VM creation, including creation from a restore point. Public sites need a token. See Licenses. Pages on localhost, a name ending in .localhost, a 127.0.0.0/8 address or [::1] need no token.
detail.reason |
Code | Meaning |
|---|---|---|
license-required |
PERMISSION_DENIED |
A public site got no token. detail.rejected is "public-requires-license" in the official frame, or "self-host-requires-license" for self-hosting. |
license-invalid |
PERMISSION_DENIED |
The engine did not accept the token for this page; detail.rejected says why. |
detail.rejected is a LicenseRejection:
| Value | Meaning |
|---|---|
malformed |
The token is not a well-formed license token. |
unsupported-version |
The token uses a format this engine does not read. |
unknown-key |
The token is signed with a key this engine does not trust. |
bad-signature |
The signature does not verify. |
expired |
The license has passed its expiry grace period. |
not-yet-valid |
The license is not valid yet. |
origin-mismatch |
The license is valid, but for other origins. |
not-self-host-license |
The license covers this origin, but not self-hosting. |
self-host-requires-license |
A self-hosted engine got no token. |
public-requires-license |
A public embedding page needs a registered token. |
issuer-policy-violation |
The token requests permissions or a lifetime its signer cannot grant. |
An invalid token never falls back to free public admission. Older published SDK/runtime versions retain their previous behavior. Running VMs continue when a token expires. License failures do not delete files, caches or restore points.
Workspace
Section titled “Workspace”detail.reason |
Code | Meaning |
|---|---|---|
workspace-in-use |
STORAGE_ERROR |
Another VM, in this tab or another, holds this workspaceId. Pass workspaceInUse: "temporary" to open a temporary workspace instead. |
too-large |
STORAGE_ERROR |
A read above maxBytes, or a write above 16 MiB. |
version-mismatch |
STORAGE_ERROR |
write with ifVersion found another version, or no file. |
exists |
STORAGE_ERROR |
write with ifVersion: null found an entry, or rename found an entry at the target. |
not-a-file |
STORAGE_ERROR |
read or write met a directory or another non-file. |
not-a-directory |
STORAGE_ERROR |
A path component is not a directory, or a watched path is not a directory. |
busy |
STORAGE_ERROR |
The entry stayed busy in the guest after the SDK’s own retries. |
image-update-required |
FEATURE_NOT_AVAILABLE |
System: the image’s guest agent has no workspace file operations. |
no-root-filesystem |
FEATURE_NOT_AVAILABLE |
Userspace: the VM has no root filesystem. |
Images
Section titled “Images”detail.reason |
Code | Meaning |
|---|---|---|
image-not-cached |
STORAGE_ERROR, sometimes STORAGE_NOT_FOUND |
Image data needed locally is missing or damaged. With imagePreparation: "before-ready" the SDK does not download it implicitly; repair it with vm.prepareImage(). |
base-missing |
STORAGE_NOT_FOUND |
The image that a restore point or a workspace needs is no longer stored in this browser. |
untrusted-key |
PROTOCOL_ERROR |
The image is signed by another key than the reference’s trust. detail.keyId names the image’s key. Regenerate the reference with oxvm assets install --image <bundle> --reference <file>. |
image-trust-changed |
PROTOCOL_ERROR |
A Userspace workspace was saved on an image signed by another key; detail.keyId names that earlier key. The saved state is never booted. Open it with restorePoint: "update-image" to keep its /workspace files on the configured image, or use another workspaceId. |
Restore points and backups
Section titled “Restore points and backups”detail.reason |
Code | Meaning |
|---|---|---|
runtime-mismatch |
FEATURE_NOT_AVAILABLE |
The restore point belongs to the other mode. |
js-process-active |
FEATURE_NOT_AVAILABLE |
snapshots.capture or suspend while a JavaScript process (spawnJS, a module command or acceleration) runs. Stop it first. |
snapshot-older-format |
SNAPSHOT_VERSION |
The restore point was written by an older SDK in a format this one cannot read. |
snapshot-newer-format |
SNAPSHOT_VERSION |
The restore point needs a newer SDK. |
agent-unavailable |
GUEST_CRASH |
The restored guest agent did not answer. |
backup-wrong-file |
INVALID_ARGUMENT |
The file is not a OxVM backup. |
backup-damaged |
INVALID_ARGUMENT |
The backup is damaged or incomplete. |
backup-other-environment |
INVALID_ARGUMENT |
The backup belongs to another environment. |
backup-newer |
SNAPSHOT_VERSION |
The backup needs a newer SDK. |
backup-older |
SNAPSHOT_VERSION |
The backup comes from an older SDK and cannot be opened. |
backup-no-space |
QUOTA_EXCEEDED |
There is not enough space in this browser. |
WebAssembly modules
Section titled “WebAssembly modules”These come from spawnModule when a module does not start, from enableModuleCommands, and from the oxvm wasm commands.
detail.reason |
Code | Meaning |
|---|---|---|
wasm-module-launch |
GUEST_CRASH |
The launch description was missing, too large or invalid. |
wasm-module-integrity |
GUEST_CRASH |
A file or the adapter did not match its pinned sha256. The call rejects before any process exists, and detail.file names the file. |
wasm-module-artifact |
CORE_LOAD_FAILED |
A pinned file could not be downloaded: the request failed, or the server answered with an HTTP error. |
wasm-module-prerequisite |
FEATURE_NOT_AVAILABLE |
A declared browser feature or Linux program is missing, or requires.browser names indexeddb or web-locks, which the module frame does not have. detail.missing lists them. |
wasm-module-isolation-unavailable |
FEATURE_NOT_AVAILABLE |
This browser cannot isolate module workers, so modules do not run. detail.capability names the check that failed: frame-load, frame-cross-origin-isolation, separate-origin, worker-shared-memory, worker-atomics-wait, blob-workers, wasm-compilation, separate-agent-cluster or module-frame-lost. WebKit and Safari fail blob-workers. A self-hosted page also gets frame-load when it does not serve the module frame with its headers. |
module-frame-asset |
CORE_LOAD_FAILED |
The module frame’s broker.js or runner.js could not be downloaded from <runtime.baseUrl>module-frame/. |
wasm-module-copy-limit |
QUOTA_EXCEEDED |
The VM would hold more than 512 MiB of checked module files. |
wasm-module-adapter |
GUEST_CRASH |
The adapter threw, had the wrong shape or returned an invalid status. |
wasm-module-busy |
QUOTA_EXCEEDED |
Another process holds the workspace lease or one of the module’s endpoints. |
wasm-module-ready |
PROTOCOL_ERROR |
A service reported no valid ready line. |
wasm-module-options |
INVALID_ARGUMENT |
An option passed to spawnModule or enableModuleCommands is unknown, has the wrong type or is out of range, or a required one is missing. |
wasm-module-commands |
INVALID_ARGUMENT |
enableModuleCommands got a service or a module without commands, a commands list that is empty, repeats a name or names one the module does not declare, a concurrency that is not an integer from 1 to 32, or another field, such as args. |
wasm-module-command-conflict |
INVALID_ARGUMENT |
Another enableModuleCommands call already turned on one of the names in this VM. |
wasm-module-command-unavailable |
FEATURE_NOT_AVAILABLE |
The VM cannot run module commands: it was not created by this copy of the SDK, is a System VM, has a root initial user or no image, or the page is not cross-origin isolated. |
wasm-module-command-limit |
QUOTA_EXCEEDED |
The VM already has 16 sets of commands on, or would have more than 64 command names. |
wasm-manifest-invalid |
INVALID_ARGUMENT |
A manifest, lock or launch description failed validation. |
Network failures inside a module
Section titled “Network failures inside a module”These are not VMErrors: module code sees them, and a command reports them as one line and status 69 (see Module networking). fetch rejects with TypeError("fetch failed") whose cause is a NetError; host.net and sockets throw the NetError itself.
code |
reason |
Meaning |
|---|---|---|
EPERM |
vm-local-only |
The VM is not connected to a relay. |
ECONNRESET |
none | The user revoked the connection, or the peer reset it. |
EACCES |
module-network-reach |
The destination is beyond the module’s declared reach. |
Node’s certificate codes, such as UNABLE_TO_GET_ISSUER_CERT_LOCALLY |
none | A TlsError: the VM’s /etc/ssl/cert.pem does not trust the server’s certificate, or it is not valid for the name. |
Previews
Section titled “Previews”These come from exposePort and preview handles. When a preview fails lists the causes of exposePort errors without a reason.
detail.reason |
Code | Meaning |
|---|---|---|
service-worker-blocked |
PERMISSION_DENIED |
The browser refused the preview origin’s Service Worker. Some privacy settings block Service Workers in cross-site frames. |
service-worker-failed |
RELAY_ERROR |
The preview origin’s Service Worker failed to start. Check the preview files and their headers. |
Site access
Section titled “Site access”setSiteAccess, and exposePort with siteAccess, report these. See Let preview pages reach other sites.
detail.reason |
Code | Meaning |
|---|---|---|
preview-host-outdated |
FEATURE_NOT_AVAILABLE |
The preview host did not answer within 10 seconds and has answered no change of this session before, because its files predate site access. Update them. |
no-worker |
RELAY_ERROR |
No preview Service Worker took the change. |
no-answer |
RELAY_ERROR |
The preview origin answered an earlier change of this session, but not this one within 10 seconds. |
stale |
PROTOCOL_ERROR |
The preview’s Service Worker already holds this or a newer change. |
retired |
ABORTED |
The preview session ended before the change applied. |
The same calls also fail without a reason:
INVALID_ARGUMENT: the access is invalid (an unknown kind or key, a site thatpreviewSiterefuses, more than 64 sites), or the options are, includingexposePortoptions other thansignalandsiteAccess.ABORTED: the handle was closed, yoursignalaborted, or the session ended before the change applied.PROTOCOL_ERROR: the VM’s disposal began.
A change that failed with RELAY_ERROR, with FEATURE_NOT_AVAILABLE or because its signal aborted may still apply later; call setSiteAccess again to settle it. watchBlockedSites rejects with INVALID_ARGUMENT without a listener function or an AbortSignal, with ABORTED after close, and with PROTOCOL_ERROR once the VM’s disposal began.
Relay failures
Section titled “Relay failures”vm.network.connect, and createVM with network: { mode: "relay" }, report the RelayFailureReason in detail.reason. vm.network.state carries the same value when its kind is "failed".
detail.reason |
Code |
|---|---|
permission-denied, destination-denied |
PERMISSION_DENIED |
quota-exceeded |
QUOTA_EXCEEDED |
protocol-error |
PROTOCOL_ERROR |
relay-not-found, discovery-failed, approval-denied, approval-expired, authentication-failed, version-mismatch, timed-out, disconnected, connection-refused, connection-reset, network-unreachable, host-unreachable |
RELAY_ERROR |
Invalid connection options fail with INVALID_ARGUMENT before any connection starts. The relay’s version-mismatch comes with RELAY_ERROR, while the workspace reason of the same name comes with STORAGE_ERROR, so check code as well as detail.reason.
Local data
Section titled “Local data”detail.reason |
Code | Meaning |
|---|---|---|
local-data-in-use |
STORAGE_ERROR |
eraseLocalData() from @oxvm/sdk/diagnostics found a workspace still open in another tab. Nothing was erased. |
Errors of the oxvm command use the same codes; see CLI.