copy/v86 · error · Error

zstd worker aborted

Error message

zstd worker aborted

What it means

The zstd decompression worker instantiates a WebAssembly module whose environment provides an 'abort' function. When the zstd WASM code calls its abort intrinsic (an internal assertion/panic), the worker surfaces it as this error, indicating decompression could not proceed.

Source

Thrown at src/browser/starter.js:712

            let wasm;

            globalThis.onmessage = function(e)
            {
                if(!wasm)
                {
                    const env = Object.fromEntries([
                        "cpu_exception_hook", "run_hardware_timers",
                        "cpu_event_halt", "microtick", "get_rand_int", "stop_idling",
                        "io_port_read8", "io_port_read16", "io_port_read32",
                        "io_port_write8", "io_port_write16", "io_port_write32",
                        "mmap_read8", "mmap_read32",
                        "mmap_write8", "mmap_write16", "mmap_write32", "mmap_write64", "mmap_write128",
                        "codegen_finalize",
                        "jit_clear_func", "jit_clear_all_funcs",
                    ].map(f => [f, () => console.error("zstd worker unexpectedly called " + f)]));

                    env["__indirect_function_table"] = new WebAssembly.Table({ element: "anyfunc", initial: 1024 });
                    env["abort"] = () => { throw new Error("zstd worker aborted"); };
                    env["log_from_wasm"] = env["console_log_from_wasm"] = (off, len) => {
                        console.log(read_sized_string_from_mem(wasm.exports.memory.buffer, off, len));
                    };
                    env["dbg_trace_from_wasm"] = () => console.trace();

                    wasm = new WebAssembly.Instance(new WebAssembly.Module(e.data), { "env": env });
                    return;
                }

                const { src, decompressed_size, id } = e.data;
                const exports = wasm.exports;

                const zstd_context = exports["zstd_create_ctx"](src.length);
                new Uint8Array(exports.memory.buffer).set(src, exports["zstd_get_src_ptr"](zstd_context));

                const ptr = exports["zstd_read"](zstd_context, decompressed_size);
                const result = exports.memory.buffer.slice(ptr, ptr + decompressed_size);
                exports["zstd_read_free"](ptr, decompressed_size);

View on GitHub (pinned to 180830d539)

Solutions

  1. Verify the zstd WASM module and the compressed input data are complete and not corrupted (re-download/serve correct files)
  2. Check the browser supports WebAssembly and the required features; try a current browser version
  3. Check worker memory limits — large decompressions may exceed them; reduce input size or run on a main-thread fallback if available
  4. Inspect the console for preceding WASM messages (log_from_wasm output) to identify the underlying assertion

Example fix

worker.onmessage = e => {
    if (e.data && e.data.type === "error" || workerAborted) {
    // before: silently hang
    // after: fall back or report
    handleDecompressFailure(e);
    }
};
Defensive patterns

Strategy: try-catch

Validate before calling

if (typeof WebAssembly !== "object") {
    fallbackToNonZstdPath();
}
// validate input before posting to worker
if (!(compressed instanceof Uint8Array) || compressed.byteLength === 0) {
    throw new Error("invalid zstd input");
}

Type guard

function isZstdWorkerError(e) {
    return e instanceof Error && e.message === "zstd worker aborted";
}

Try / catch

worker.onerror = e => {
    // 'zstd worker aborted' propagates as an worker error event
    reportDecompressFailure(e.message || "zstd worker aborted");
    restartWorkerOrFallback();
};

Prevention

When it happens

Trigger: The zstd WASM module compiled from e.data hits an internal abort (invalid/corrupt WASM or compressed input, memory allocation failure, or unsupported operation) inside the worker started via the_worker(). Any call to the imported env.abort function throws this Error in the worker.

Common situations: Corrupted or truncated zstd-compressed state/ROM data being decompressed; serving a mismatched or broken v86-zstd WASM build; out-of-memory conditions in the worker during large state restores; browser lacking full WebAssembly support for the compiled features.


AI-assisted analysis of copy/v86@180830d539 (2026-08-31). Data as JSON: /api/errors/e83f36b880b6b932. Report an issue: GitHub.