dotnet/runtime · critical · Error

Mismatched git hashes between loader and runtime. Loader

Error message

Mismatched git hashes between loader and runtime. Loader: ${runtimeApi.runtimeBuildInfo.gitHash}, Runtime: ${GitHash}

What it means

The JSInterop Runtime module (System.Runtime.InteropServices.JavaScript.Native/interop) bakes a git hash at build time and compares it to the loader's runtimeBuildInfo.gitHash during dotnetInitializeModule(). A mismatch means the interop/runtime support JS was produced by a different build than the .NET runtime/loader and the interop ABI may not match.

Solutions

  1. Deploy the complete _framework output from one build so the interop JS and runtime share a hash.
  2. Clear all caches (browser, CDN, service worker) so no stale interop JS is served.
  3. Clean and rebuild the solution (rm -rf bin obj) to guarantee a single stamped hash.
  4. Confirm the workload/SDK version is consistent across all dotnet.* support files in wwwroot.

Example fix

// before: nightly runtime + release interop JS

// after
// dotnet workload install wasm-tools --version <one consistent version>
// dotnet publish -c Release
// deploy the entire _framework together
Defensive patterns

Strategy: validation

Validate before calling

import GitHash from "consts:gitHash";

function assertInteropHashMatches(runtimeApi: any) {
  const loader = runtimeApi?.runtimeBuildInfo?.gitHash;
  if (loader && loader !== GitHash) {
    throw new Error(`Interop build mismatch: loader=${loader}, interop=${GitHash}`);
  }
}

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: The interop bundle's consts:gitHash differs from the loader-reported hash; both are non-empty. Typically from mixing the interop JS of one workload version with the runtime of another.

Common situations: Stale cached interop JS vs. fresh runtime wasm; partial publish; dev rebuild that touched only the runtime project; CDN serving mixed-versions; using a nightly runtime with a release interop bundle.

Related errors


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

Appendix: source

Thrown at src/native/libs/System.Runtime.InteropServices.JavaScript.Native/interop/index.ts:36

import { cancelPromise } from "./cancelable-promise";
import { loadLazyAssembly, loadSatelliteAssemblies } from "./lazy";
import { jsInteropState } from "./marshal";
import { initializeScheduling, abortInteropTimers } from "./scheduling";
import { wsAbort, wsClose, wsCreate, wsGetState, wsOpen, wsReceive, wsSend } from "./web-socket";
import {
    httpSupportsStreamingRequest, httpSupportsStreamingResponse, httpCreateController, httpGetResponseType,
    httpGetResponseStatus, httpAbort, httpTransformStreamWrite, httpTransformStreamClose, httpFetch,
    httpFetchStream, httpFetchBytes, httpGetResponseHeaderNames, httpGetResponseHeaderValues, httpGetResponseBytes,
    httpGetResponseLength, httpGetStreamedResponseBytes,
} from "./http";

export function dotnetInitializeModule(internals: InternalExchange): void {
    if (!Array.isArray(internals)) throw new Error("Expected internals to be an array");
    const runtimeApi = internals[InternalExchangeIndex.RuntimeAPI];
    if (typeof runtimeApi !== "object") throw new Error("Expected internals to have RuntimeAPI");

    if (runtimeApi.runtimeBuildInfo.gitHash && runtimeApi.runtimeBuildInfo.gitHash !== GitHash) {
        throw new Error(`Mismatched git hashes between loader and runtime. Loader: ${runtimeApi.runtimeBuildInfo.gitHash}, Runtime: ${GitHash}`);
    }

    const runtimeApiLocal: Partial<RuntimeAPI> = {
        getAssemblyExports,
        setModuleImports,
    };
    Object.assign(runtimeApi, runtimeApiLocal);
    Object.assign(runtimeApi.INTERNAL, {
        hasProperty,
        getTypeOfProperty,
        getProperty,
        setProperty,
        getGlobalThis,
        getDotnetInstance,
        dynamicImport,
        bindCsFunction,
        loadSatelliteAssemblies,
        loadLazyAssembly,

View on GitHub (pinned to 60108ba66e)