dotnet/runtime · critical · Error

Unsupported Webcil version: ${webcilVersion}

Error message

Unsupported Webcil version: ${webcilVersion}

What it means

instantiateWebcilModule (host/assets.ts) instantiates the Webcil interpreter WASM module and reads its exported webcilVersion global. The loader expects exactly version 0; any other value means the Webcil .wasm shipped by this runtime is incompatible with the JS host code, and it throws naming the version found.

Source

Thrown at src/native/libs/Common/JavaScript/host/assets.ts:60

        loadedAssemblies.set(virtualPath, { ptr, length: bytes.length });
        loadedAssemblies.set(shortName, { ptr, length: bytes.length });
    } finally {
        _ems_.stackRestore(sp);
    }
}

export async function instantiateWebcilModule(webcilPromise: Promise<Response>, memory: WebAssembly.Memory, virtualPath: string): Promise<void> {

    const imports: WebAssembly.Imports = {
        webcil: {
            memory,
        }
    };

    const { instance } = await instantiateWasm(webcilPromise, imports);
    const webcilVersion = (instance.exports.webcilVersion as WebAssembly.Global).value;
    if (webcilVersion !== 0) {
        throw new Error(`Unsupported Webcil version: ${webcilVersion}`);
    }

    const sp = _ems_.stackSave();
    try {
        const sizePtr = _ems_.stackAlloc(sizeOfPtr);
        const getWebcilSize = instance.exports.getWebcilSize as (destPtr: number) => void;
        getWebcilSize(sizePtr as any);
        const payloadSize = _ems_.HEAPU32[sizePtr as any >>> 2];

        if (payloadSize === 0) {
            throw new Error("Webcil payload size is 0");
        }

        const ptrPtr = _ems_.stackAlloc(sizeOfPtr);
        if (_ems_._posix_memalign(ptrPtr as any, 16, payloadSize)) {
            throw new Error("posix_memalign failed for Webcil payload");
        }

View on GitHub (pinned to 290d5ab72c)

Solutions

  1. Republish the project so all framework files (dotnet.js, dotnet.runtime.js, dotnet.native.wasm, webcil.wasm) come from the same .NET SDK version.
  2. Clear browser/CDN cache so the matching webcil.wasm is fetched.
  3. If using a CDN, pin the version path instead of a floating tag.
  4. Verify the deployed webcil.wasm hash matches the one in blazor.boot.json.

Example fix

<!-- before: CDN serves mismatched webcil version -->
<script src="https://cdn.example.com/dotnet/8.0.0/dotnet.js"></script>
<!-- webcil.wasm cached from 9.0.0 preview -->

<!-- after: pin all artifacts to the same version -->
<script src="https://cdn.example.com/dotnet/8.0.7/dotnet.js"></script>
<!-- bust cache for webcil.wasm too -->
Defensive patterns

Strategy: validation

Validate before calling

// After instantiating webcil wasm, before relying on it
const version = (instance.exports.webcilVersion as WebAssembly.Global).value;
if (version !== 0) throw new Error(`webcil.wasm ABI version ${version} — redeploy matching runtime files`);

Type guard

function isExpectedWebcilVersion(exports: any): boolean {
  return (exports?.webcilVersion as WebAssembly.Global | undefined)?.value === 0;
}

Try / catch

try {
  await instantiateWebcilModule(promise, memory, path);
} catch (err) {
  if (/Unsupported Webcil version/.test(err.message)) {
    // bust cache and reload once so all artifacts match
    if (!location.href.includes('bust=')) location.href += '?bust=' + Date.now();
  } else throw err;
}

Prevention

When it happens

Trigger: A mismatch between the dotnet.runtime.js / dotnet.native.js host and the webcil.wasm interpreter module — e.g. the webcil wasm was replaced by a newer/older version that bumped its ABI version export.

Common situations: Manually swapping webcil.wasm from a different .NET release; partial upgrade where some framework files were updated but webcil.wasm was cached/left behind; CDN serving a stale webcil.wasm; build pipeline mixing artifacts from two SDK versions.

Related errors


AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06). Data as JSON: /api/errors/1c559e004c75efe3. Report an issue: GitHub.