dotnet/runtime · critical · Error

Unsupported Webcil version: ${webcilVersion}

Error message

Unsupported Webcil version: ${webcilVersion}

What it means

Thrown by finishWebcilInstance() (src/native/libs/Common/JavaScript/host/assets.ts:143) after instantiation succeeds. The webcil wrapper module exports a webcilVersion global; the loader only accepts versions 0 (plain) and 1. Any version > 1 or < 0 is rejected to prevent loading an image whose ABI the host does not understand.

Source

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

        }
        const tableStartIndex = _ems_.wasmTable.length;
        _ems_.wasmTable.grow(tableSize);
        webcilImports.stackPointer = stackPointer;
        webcilImports.rtlRestoreContextTag = rtlRestoreContextTag as unknown as WebAssembly.ImportValue;
        webcilImports.asyncContinuation = asyncContinuation as unknown as WebAssembly.ImportValue;
        webcilImports.table = _ems_.wasmTable;
        webcilImports.tableBase = new WebAssembly.Global({ value: "i32", mutable: false }, tableStartIndex);
        webcilImports.imageBase = new WebAssembly.Global({ value: "i32", mutable: false }, payloadPtr);
    }
    return webcilImports;
}

// Copies the payload into the allocated buffer, fills the R2R table (if any) and registers the
// loaded image for BrowserHost_ExternalAssemblyProbe.
function finishWebcilInstance(instance: WebAssembly.Instance, payloadPtr: number, payloadSize: number, tableSize: number, virtualPath: string): void {
    const webcilVersion = (instance.exports.webcilVersion as WebAssembly.Global).value;
    if (webcilVersion > 1 || webcilVersion < 0) {
        throw new Error(`Unsupported Webcil version: ${webcilVersion}`);
    }

    const getWebcilPayload = instance.exports.getWebcilPayload as (ptr: number, size: number) => void;
    getWebcilPayload(payloadPtr, payloadSize);
    if (tableSize > 0) {
        const fillWebcilTable = instance.exports.fillWebcilTable as () => void;
        fillWebcilTable();
    }

    const name = virtualPath.startsWith(browserVirtualAppBase)
        ? virtualPath.substring(browserVirtualAppBase.length)
        : virtualPath.substring(virtualPath.lastIndexOf("/") + 1);
    _ems_.dotnetLogger.debug(`Registered Webcil assembly '${virtualPath}' (name: '${name}') at ${payloadPtr.toString(16)} length ${payloadSize}`);
    loadedAssemblies.set(virtualPath, { ptr: payloadPtr, length: payloadSize });
    loadedAssemblies.set(name, { ptr: payloadPtr, length: payloadSize });
}

export function BrowserHost_ExternalAssemblyProbe(pathPtr: CharPtr, outDataStartPtr: VoidPtrPtr, outSize: VoidPtr): boolean {

View on GitHub (pinned to 60108ba66e)

Solutions

  1. Update the runtime/loader to a version that supports the webcil version your SDK emits.
  2. Re-publish/re-crossgen the assemblies with the toolchain matching the deployed runtime.
  3. If intentionally on an older runtime, disable R2R/webcil publishing so plain images are produced.

Example fix

# before: SDK emits webcil v2, runtime only knows v0/v1 -> Unsupported Webcil version: 2

# after: align toolchain versions
# either upgrade runtime, or publish with: <PublishReadyToRun>false</PublishReadyToRun>
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED_WEBCIL = new Set([0, 1]);
function isSupportedWebcilVersion(v: unknown): boolean {
  return typeof v === 'number' && SUPPORTED_WEBCIL.has(v);
}

Type guard

function isKnownWebcilVersion(v: unknown): v is 0 | 1 {
  return v === 0 || v === 1;
}

Prevention

When it happens

Trigger: After WebAssembly.instantiate of the webcil module, finishWebcilInstance reads (instance.exports.webcilVersion).value and compares against [0,1]. A version outside that range throws.

Common situations: A newer Webcil format produced by a newer SDK/runtime than the host loader supports; a hand-built or corrupted webcil image with a bogus version global; downgrading the runtime while keeping assemblies produced by a newer toolchain.

Related errors


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