{"record":{"id":"5e239455083c0aad","repo":"dotnet/runtime","slug":"mismatched-git-hashes-between-loader-and-runtime-5e2394","errorCode":null,"errorMessage":"Mismatched git hashes between loader and runtime. Loader: ${runtimeApi.runtimeBuildInfo.gitHash}, BrowserUtils: ${GitHash}","messagePattern":"Mismatched git hashes between loader and runtime\\. Loader: (.+?), BrowserUtils: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"src/native/libs/System.Native.Browser/utils/index.ts","lineNumber":31,"sourceCode":"    zeroRegion,\n    arrayBufferNeedsCopy,\n    viewOrCopy,\n} from \"./memory\";\nimport { stringsInit, stringToUTF16, stringToUTF16Ptr, stringToUTF8, stringToUTF8Ptr, utf16ToString, utf8ToStringRelaxed } from \"./strings\";\nimport { abortPosix, getExitStatus } from \"./host\";\nimport { dotnetUpdateInternals, dotnetUpdateInternalsSubscriber } from \"../utils/cross-module\";\nimport { initPolyfills } from \"../utils/polyfills\";\nimport { registerRuntime } from \"./runtime-list\";\nimport { registerCDAC } from \"./cdac\";\nimport { abortBackgroundTimers, runBackgroundTimers } from \"./scheduling\";\n\nexport function dotnetInitializeModule(internals: InternalExchange): void {\n    if (!Array.isArray(internals)) throw new Error(\"Expected internals to be an array\");\n    const runtimeApi = internals[InternalExchangeIndex.RuntimeAPI];\n    if (typeof runtimeApi !== \"object\") throw new Error(\"Expected internals to have RuntimeAPI\");\n\n    if (runtimeApi.runtimeBuildInfo.gitHash && runtimeApi.runtimeBuildInfo.gitHash !== GitHash) {\n        throw new Error(`Mismatched git hashes between loader and runtime. Loader: ${runtimeApi.runtimeBuildInfo.gitHash}, BrowserUtils: ${GitHash}`);\n    }\n\n    initPolyfills();\n    stringsInit();\n    registerRuntime(runtimeApi);\n    registerCDAC(runtimeApi);\n\n    if (!Array.isArray(internals)) throw new Error(\"Expected internals to be an array\");\n    const runtimeApiLocal: Partial<RuntimeAPI> = {\n        setHeapB32, setHeapB8, setHeapU8, setHeapU16, setHeapU32, setHeapI8, setHeapI16, setHeapI32, setHeapI52, setHeapU52, setHeapI64Big, setHeapF32, setHeapF64,\n        getHeapB32, getHeapB8, getHeapU8, getHeapU16, getHeapU32, getHeapI8, getHeapI16, getHeapI32, getHeapI52, getHeapU52, getHeapI64Big, getHeapF32, getHeapF64,\n        localHeapViewI8, localHeapViewI16, localHeapViewI32, localHeapViewI64Big, localHeapViewU8, localHeapViewU16, localHeapViewU32, localHeapViewF32, localHeapViewF64,\n    };\n    Object.assign(runtimeApi, runtimeApiLocal);\n\n    internals[InternalExchangeIndex.BrowserUtilsExportsTable] = browserUtilsExportsToTable({\n        utf16ToString,\n        stringToUTF16,","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/native/libs/System.Native.Browser/utils/index.ts#L13-L49","documentation":"The BrowserUtils module compares the loader's runtimeBuildInfo.gitHash against its own compiled-in GitHash constant (imported from consts:gitHash). A mismatch means the utils JS bundle and the runtime/loader were built from different source revisions, which would break the internal ABI, so init aborts.","triggerScenarios":"Loading a BrowserUtils bundle (utils JS) from one commit while the runtime/loader carries a different runtimeBuildInfo.gitHash.","commonSituations":"Partial deploy of dotnet bundles; CDN/browser cache mixing old and new utils+runtime; local dev across repos with mismatched builds.","solutions":["Clean rebuild + republish so the utils bundle and runtime share the same git hash/SDK.","Cache-bust all dotnet artifacts together — versioned folder or content-hash in URL.","Verify no service worker/CDN is serving a stale utils.js alongside a new runtime."],"exampleFix":"// before: utils.js cached at v7 while runtime is v8\n// after: bust cache, serve all from /8.0.x/","handlingStrategy":"validation","validationCode":"const loaderHash = runtimeApi.runtimeBuildInfo?.gitHash;\nif (loaderHash && loaderHash !== GitHash) {\n  throw new Error(\"Refusing init: BrowserUtils/runtime git hash mismatch — republish with a matching build\");\n}","typeGuard":null,"tryCatchPattern":"try { dotnetInitializeModule(internals); }\ncatch (e) {\n  if (/Mismatched git hashes/.test(e.message)) purgeCacheAndReload();\n  else throw e;\n}","preventionTips":["Serve all dotnet bundles from one versioned folder so caches can't mix versions.","Purge CDN/service-worker caches on every release."],"tags":["version-mismatch","build","deployment"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}