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}, Diagnostics: ${GitHash}

What it means

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.

Source

Thrown at src/native/libs/System.Native.Browser/diagnostics/index.ts:26

import { dotnetApi, dotnetUpdateInternals, dotnetUpdateInternalsSubscriber } from "./cross-module";
import { registerExit } from "./exit";
import { installNativeSymbols, symbolicateStackTrace } from "./symbolicate";
import { installLoggingProxy } from "./console-proxy";
import { collectMetrics } from "./dotnet-counters";
import { collectGcDump } from "./dotnet-gcdump";
import { collectCpuSamples } from "./dotnet-cpu-profiler";
import { 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";
import { ds_rt_browser_performance_measure } from "./browser-profiler";

export function dotnetInitializeModule(internals: InternalExchange): void {
    if (!Array.isArray(internals)) throw new Error("Expected internals to be an array");

    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}, Diagnostics: ${GitHash}`);
    }

    internals[InternalExchangeIndex.DiagnosticsExportsTable] = diagnosticsExportsToTable({
        symbolicateStackTrace,
        installNativeSymbols,
        ds_rt_websocket_create,
        ds_rt_websocket_send,
        ds_rt_websocket_poll,
        ds_rt_websocket_recv,
        ds_rt_websocket_close,
        ds_rt_browser_performance_measure,
    });
    dotnetUpdateInternals(internals, dotnetUpdateInternalsSubscriber);

    registerExit();
    installLoggingProxy();
    initializeDS();

View on GitHub (pinned to 290d5ab72c)

Solutions

  1. Hard-refresh / clear cache so the diagnostics JS reloads alongside the rest of the framework.
  2. Serve all framework assets with cache-busting versioned URLs.
  3. Purge the CDN atomically across all framework files on deploy.
  4. Republish with a single consistent .NET workload version.

Example fix

// before: stale-cached diagnostics JS
<script src="_framework/dotnet.diagnostics.js"></script>
// after: cache-bust
<script src="_framework/dotnet.diagnostics.js?v=20260806a"></script>
Defensive patterns

Strategy: validation

Validate before calling

// Confirm diagnostics module and runtime share a git hash
import diagGitHash from 'consts:gitHash';
const api = internals[InternalExchangeIndex.RuntimeAPI];
if (api?.runtimeBuildInfo?.gitHash && api.runtimeBuildInfo.gitHash !== diagGitHash) {
  throw new Error('Diagnostics/runtime version skew; reload all framework assets.');
}

Prevention

When it happens

Trigger: Diagnostics module init where internals[RuntimeAPI].runtimeBuildInfo.gitHash is non-empty and !== the diagnostics module's bundled GitHash.

Common situations: 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.

Related errors


AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06). Data as JSON: /api/errors/49c999777bf9cffa. Report an issue: GitHub.