{"record":{"id":"9e6472c6fc9bb250","repo":"dotnet/runtime","slug":"mismatched-git-hashes-between-loader-and-runtime-9e6472","errorCode":null,"errorMessage":"Mismatched git hashes between loader and runtime. Loader: ${runtimeApi.runtimeBuildInfo.gitHash}, Runtime: ${GitHash}","messagePattern":"Mismatched git hashes between loader and runtime\\. Loader: (.+?), Runtime: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"src/native/libs/System.Runtime.InteropServices.JavaScript.Native/interop/index.ts","lineNumber":36,"sourceCode":"import { cancelPromise } from \"./cancelable-promise\";\nimport { loadLazyAssembly, loadSatelliteAssemblies } from \"./lazy\";\nimport { jsInteropState } from \"./marshal\";\nimport { initializeScheduling, abortInteropTimers } from \"./scheduling\";\nimport { wsAbort, wsClose, wsCreate, wsGetState, wsOpen, wsReceive, wsSend } from \"./web-socket\";\nimport {\n    httpSupportsStreamingRequest, httpSupportsStreamingResponse, httpCreateController, httpGetResponseType,\n    httpGetResponseStatus, httpAbort, httpTransformStreamWrite, httpTransformStreamClose, httpFetch,\n    httpFetchStream, httpFetchBytes, httpGetResponseHeaderNames, httpGetResponseHeaderValues, httpGetResponseBytes,\n    httpGetResponseLength, httpGetStreamedResponseBytes,\n} from \"./http\";\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}, Runtime: ${GitHash}`);\n    }\n\n    const runtimeApiLocal: Partial<RuntimeAPI> = {\n        getAssemblyExports,\n        setModuleImports,\n    };\n    Object.assign(runtimeApi, runtimeApiLocal);\n    Object.assign(runtimeApi.INTERNAL, {\n        hasProperty,\n        getTypeOfProperty,\n        getProperty,\n        setProperty,\n        getGlobalThis,\n        getDotnetInstance,\n        dynamicImport,\n        bindCsFunction,\n        loadSatelliteAssemblies,\n        loadLazyAssembly,","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/native/libs/System.Runtime.InteropServices.JavaScript.Native/interop/index.ts#L18-L54","documentation":"The interop module compares the loader's runtimeBuildInfo.gitHash against its own compiled-in GitHash constant (consts:gitHash). A mismatch means the interop JS bundle and the runtime/loader were built from different source revisions, which would break the JSImport/marshaler ABI, so initialization aborts.","triggerScenarios":"Loading an interop bundle from one commit while the runtime/loader carries a different runtimeBuildInfo.gitHash.","commonSituations":"Partial deploy of dotnet bundles; CDN/browser cache mixing an old interop.js with a new runtime; local dev across repos with mismatched builds.","solutions":["Clean rebuild + republish so the interop 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 interop.js alongside a new runtime."],"exampleFix":"// before: interop.js cached at v7 while runtime is v8\n// after: bust cache, serve all bundles from /8.0.x/","handlingStrategy":"validation","validationCode":"const loaderHash = runtimeApi.runtimeBuildInfo?.gitHash;\nif (loaderHash && loaderHash !== GitHash) {\n  throw new Error(\"Refusing init: interop/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.","Purge CDN/service-worker caches on every release.","Validate git-hash agreement before init in custom hosts."],"tags":["version-mismatch","build","deployment"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}