{"record":{"id":"49c999777bf9cffa","repo":"dotnet/runtime","slug":"mismatched-git-hashes-between-loader-and-runtime-49c999","errorCode":null,"errorMessage":"Mismatched git hashes between loader and runtime. Loader: ${runtimeApi.runtimeBuildInfo.gitHash}, Diagnostics: ${GitHash}","messagePattern":"Mismatched git hashes between loader and runtime\\. Loader: (.+?), Diagnostics: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/native/libs/System.Native.Browser/diagnostics/index.ts","lineNumber":26,"sourceCode":"\nimport { dotnetApi, dotnetUpdateInternals, dotnetUpdateInternalsSubscriber } from \"./cross-module\";\nimport { registerExit } from \"./exit\";\nimport { installNativeSymbols, symbolicateStackTrace } from \"./symbolicate\";\nimport { installLoggingProxy } from \"./console-proxy\";\nimport { collectMetrics } from \"./dotnet-counters\";\nimport { collectGcDump } from \"./dotnet-gcdump\";\nimport { collectCpuSamples } from \"./dotnet-cpu-profiler\";\nimport { connectDSRouter, ds_rt_websocket_close, ds_rt_websocket_create, ds_rt_websocket_poll, ds_rt_websocket_recv, ds_rt_websocket_send, initializeDS } from \"./diagnostic-server\";\nimport { ds_rt_browser_performance_measure } from \"./browser-profiler\";\n\nexport function dotnetInitializeModule(internals: InternalExchange): void {\n    if (!Array.isArray(internals)) throw new Error(\"Expected internals to be an array\");\n\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}, Diagnostics: ${GitHash}`);\n    }\n\n    internals[InternalExchangeIndex.DiagnosticsExportsTable] = diagnosticsExportsToTable({\n        symbolicateStackTrace,\n        installNativeSymbols,\n        ds_rt_websocket_create,\n        ds_rt_websocket_send,\n        ds_rt_websocket_poll,\n        ds_rt_websocket_recv,\n        ds_rt_websocket_close,\n        ds_rt_browser_performance_measure,\n    });\n    dotnetUpdateInternals(internals, dotnetUpdateInternalsSubscriber);\n\n    registerExit();\n    installLoggingProxy();\n    initializeDS();\n","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/native/libs/System.Native.Browser/diagnostics/index.ts#L8-L44","documentation":"Thrown by dotnetInitializeModule (diagnostics module) when the runtime's reported git hash differs from the GitHash compiled into the diagnostics module. This is the same build-consistency guarantee as the BrowserHost variant, enforced separately for the diagnostics module so a mixed-version diagnostics JS cannot talk to the runtime.","triggerScenarios":"Diagnostics module init where internals[RuntimeAPI].runtimeBuildInfo.gitHash is non-empty and !== the diagnostics module's bundled GitHash.","commonSituations":"Browser/CDN cached an old diagnostics JS while serving a new runtime binary; partial deploy that updates some framework files but not others; manual mix of SDK versions.","solutions":["Hard-refresh / clear cache so the diagnostics JS reloads alongside the rest of the framework.","Serve all framework assets with cache-busting versioned URLs.","Purge the CDN atomically across all framework files on deploy.","Republish with a single consistent .NET workload version."],"exampleFix":"// before: stale-cached diagnostics JS\n<script src=\"_framework/dotnet.diagnostics.js\"></script>\n// after: cache-bust\n<script src=\"_framework/dotnet.diagnostics.js?v=20260806a\"></script>","handlingStrategy":"validation","validationCode":"// Confirm diagnostics module and runtime share a git hash\nimport diagGitHash from 'consts:gitHash';\nconst api = internals[InternalExchangeIndex.RuntimeAPI];\nif (api?.runtimeBuildInfo?.gitHash && api.runtimeBuildInfo.gitHash !== diagGitHash) {\n  throw new Error('Diagnostics/runtime version skew; reload all framework assets.');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Version diagnostics JS asset URLs to invalidate stale caches.","Hard-refresh on version-mismatch symptoms.","Purge CDN for the whole framework folder atomically on deploy."],"tags":["version-mismatch","cache","deployment","diagnostics"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}