{"record":{"id":"1d770f20d87d260e","repo":"dotnet/runtime","slug":"mismatched-git-hashes-between-loader-and-runtime-1d770f","errorCode":null,"errorMessage":"Mismatched git hashes between loader and runtime. Loader: ${runtimeApi.runtimeBuildInfo.gitHash}, DOTNET_INTEROP: ${_ems_.DOTNET_INTEROP.gitHash}","messagePattern":"Mismatched git hashes between loader and runtime\\. Loader: (.+?), DOTNET_INTEROP: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"src/native/libs/System.Runtime.InteropServices.JavaScript.Native/native/index.ts","lineNumber":42,"sourceCode":"    _ems_.dotnetRuntimeExports.resolveOrRejectPromise(args);\n}\n\nexport function SystemInteropJS_CancelPromise(taskHolderGCHandle: GCHandle): void {\n    _ems_.dotnetRuntimeExports.cancelPromise(taskHolderGCHandle);\n}\n\nexport function SystemInteropJS_InvokeJSFunction(functionJSSHandle: JSHandle, args: JSMarshalerArguments): void {\n    _ems_.dotnetRuntimeExports.invokeJSFunction(functionJSSHandle, args);\n}\n\nexport const gitHash = GitHash;\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 !== _ems_.DOTNET_INTEROP.gitHash) {\n        throw new Error(`Mismatched git hashes between loader and runtime. Loader: ${runtimeApi.runtimeBuildInfo.gitHash}, DOTNET_INTEROP: ${_ems_.DOTNET_INTEROP.gitHash}`);\n    }\n\n    internals[InternalExchangeIndex.InteropJavaScriptExportsTable] = interopJavaScriptExportsToTable({\n        SystemInteropJS_GetManagedStackTrace: (args: JSMarshalerArguments) => _ems_._SystemInteropJS_GetManagedStackTrace(args),\n        SystemInteropJS_CallDelegate: (args: JSMarshalerArguments) => _ems_._SystemInteropJS_CallDelegate(args),\n        SystemInteropJS_CompleteTask: (args: JSMarshalerArguments) => _ems_._SystemInteropJS_CompleteTask(args),\n        SystemInteropJS_ReleaseJSOwnedObjectByGCHandle: (args: JSMarshalerArguments) => _ems_._SystemInteropJS_ReleaseJSOwnedObjectByGCHandle(args),\n        SystemInteropJS_BindAssemblyExports: (args: JSMarshalerArguments) => _ems_._SystemInteropJS_BindAssemblyExports(args),\n        SystemInteropJS_CallJSExport: (methodHandle: CSFnHandle, args: JSMarshalerArguments) => _ems_._SystemInteropJS_CallJSExport(methodHandle, args),\n    });\n    function interopJavaScriptExportsToTable(map: InteropJavaScriptExports): InteropJavaScriptExportsTable {\n        // keep in sync with interopJavaScriptExportsFromTable()\n        return [\n            map.SystemInteropJS_GetManagedStackTrace,\n            map.SystemInteropJS_CallDelegate,\n            map.SystemInteropJS_CompleteTask,\n            map.SystemInteropJS_ReleaseJSOwnedObjectByGCHandle,\n            map.SystemInteropJS_BindAssemblyExports,","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/native/libs/System.Runtime.InteropServices.JavaScript.Native/native/index.ts#L24-L60","documentation":"Thrown by dotnetInitializeModule when the loader-reported gitHash (runtimeApi.runtimeBuildInfo.gitHash) differs from the gitHash baked into the native interop module (_ems_.DOTNET_INTEROP.gitHash). The two halves of the runtime must be from the same build; a mismatch can cause ABI/protocol corruption, so initialization is aborted.","triggerScenarios":"Serving dotnet.js from one build and dotnet.native.js / the interop library from another (e.g. CDN cached one file, local server served another). Upgrading the SDK but leaving a stale file in the publish output.","commonSituations":"CDN/edge cache serving mixed versions; partial publish; referencing runtime files via different package versions (Microsoft.NETCore.App etc.); CI artifact assembly mixing folders.","solutions":["Clean the publish/bin/wwwroot folder and republish from a single SDK so every runtime file matches.","Bust the cache: append a version query string or update cache-control headers for runtime files.","Confirm all runtime files come from the same NuGet package version (check locks/versions).","The error prints both hashes; verify the loader hash matches the SDK you intend to ship."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function assertMatchingGitHash(loaderHash: string, nativeHash: string) {\n    if (loaderHash && nativeHash && loaderHash !== nativeHash) {\n        throw new Error(`Loader/runtime git hash mismatch: ${loaderHash} vs ${nativeHash}`);\n    }\n}","typeGuard":"const gitHashesMatch = (a?: string, b?: string): boolean =>\n    !a || !b || a === b;","tryCatchPattern":null,"preventionTips":["Republish from a single SDK build; clean output dirs first.","Bust CDN/browser cache for runtime files on every release.","Lock all runtime NuGet packages to the same version; verify with the hashes printed in the error."],"tags":["initialization","version-mismatch","loader","build-integrity","critical"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}