dotnet/runtime · error · Error
Mismatched git hashes between loader and runtime. Loader: ${
Error message
Mismatched git hashes between loader and runtime. Loader: ${runtimeApi.runtimeBuildInfo.gitHash}, BrowserHost: ${GitHash} What it means
Thrown by dotnetInitializeModule (BrowserHost) when the runtime reports a git hash that differs from the GitHash compiled into the BrowserHost module. The .NET WASM runtime requires loader JS, BrowserHost JS, and the native binary to originate from the same build; a mismatch indicates mixed versions.
Source
Thrown at src/native/libs/Common/JavaScript/host/index.ts:22
import type { InternalExchange, BrowserHostExports, RuntimeAPI, BrowserHostExportsTable, LoaderConfigInternal } from "./types";
import { InternalExchangeIndex } from "./types";
import { _ems_ } from "../ems-ambient";
import GitHash from "consts:gitHash";
import { runMain, runMainAndExit, initializeCoreCLR } from "./host";
import { registerPdbBytes, instantiateWebcilModule, registerDllBytes, installVfsFile, loadIcuData, instantiateWasm, } from "./assets";
export function dotnetInitializeModule(internals: InternalExchange): void {
if (!Array.isArray(internals)) throw new Error("Expected internals to be an array");
const runtimeApiLocal: Partial<RuntimeAPI> = {
runMain,
runMainAndExit,
};
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}, BrowserHost: ${GitHash}`);
}
Object.assign(runtimeApi, runtimeApiLocal);
internals[InternalExchangeIndex.BrowserHostExportsTable] = browserHostExportsToTable({
registerDllBytes,
installVfsFile,
loadIcuData,
initializeCoreCLR,
registerPdbBytes,
instantiateWasm,
instantiateWebcilModule,
});
_ems_.dotnetUpdateInternals(internals, _ems_.dotnetUpdateInternalsSubscriber);
setupEmscripten();
function browserHostExportsToTable(map: BrowserHostExports): BrowserHostExportsTable {
// keep in sync with browserHostExportsFromTable()View on GitHub (pinned to 290d5ab72c)
Solutions
- Hard-refresh / clear the browser cache (or disable cache during dev) so all runtime assets reload together.
- Serve runtime assets with cache-busting versioned URLs or query strings.
- Purge the CDN atomically for all framework files on each deploy.
- Reinstall/republish a single consistent .NET workload/SDK version for both loader and runtime outputs.
Example fix
// before: unversioned runtime assets get stale-cached <script src="_framework/dotnet.native.js"></script> // after: cache-bust on deploy <script src="_framework/dotnet.native.js?v=20260806a"></script>
Defensive patterns
Strategy: validation
Validate before calling
// Before initializing, confirm loader and runtime share a git hash
import runtimeGitHash from 'consts:gitHash'; // loader-side
const api = internals[InternalExchangeIndex.RuntimeAPI];
if (api?.runtimeBuildInfo?.gitHash && api.runtimeBuildInfo.gitHash !== runtimeGitHash) {
throw new Error(`Version skew detected; reload all framework assets (loader ${runtimeGitHash} vs runtime ${api.runtimeBuildInfo.gitHash}).`);
} Prevention
- Version all framework asset URLs so a new deploy invalidates old caches.
- Hard-refresh during upgrades when you see version-mismatch symptoms.
- Purge CDN entries for every framework file together, never partially.
When it happens
Trigger: dotnetInitializeModule(internals) where internals[RuntimeAPI].runtimeBuildInfo.gitHash is non-empty and !== the BrowserHost's bundled GitHash constant.
Common situations: Browser cached an old dotnet.runtime.js / dotnet.native.js while fetching a freshly deployed dotnet.native.wasm; CDN partial rollout; mixing SDK/workload versions manually; hot-reload serving stale runtime chunks.
Related errors
- Mismatched git hashes between loader and runtime. Loader: ${
- Expected internals to be an array
- Expected internals to be an array
- Mismatched git hashes between loader and runtime. Loader: ${
- Mismatched git hashes between loader and runtime. Loader: ${
AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06).
Data as JSON: /api/errors/eb46b2ac7d985a08.
Report an issue: GitHub.