abhigyanpatwari/GitNexus · error

Analyzer build or dependency runtime changed during…

Error message

Analyzer build or dependency runtime changed during analysis; refusing to stamp metadata. Retry with a stable GitNexus installation.

What it means

finalizeAnalyzerRunnerIdentity() re-resolves the analyzer identity immediately before metadata is stamped into the index and compares it to the identity captured when analysis started (analyzerRunnerIdentitiesEqual). Any difference — build digest change, dependency runtime change, version change — means the installation mutated during the run, so results would be stamped with inconsistent provenance and the run is rejected with retry guidance.

Solutions

  1. Re-run the analysis after the installation change completes; the retry will capture a consistent identity.
  2. Freeze the tool version during long jobs (pin gitnexus@<version> in CI, disable auto-update).
  3. Do not run npm install or gitnexus embeddings install while an analyze is in progress.
  4. For MCP servers, restart the server after upgrading so it never straddles two installs.

Example fix

# before: upgrade lands mid-run
T1: npx gitnexus analyze --embeddings   # long run
T2: npm install -g gitnexus@latest
# Analyzer build or dependency runtime changed during analysis; refusing to stamp metadata. Retry with a stable GitNexus installation.

# after: pin and sequence
T2: (wait for T1 to finish)
npx gitnexus@1.14.0 analyze --embeddings
Defensive patterns

Strategy: retry

Validate before calling

// Prevent mid-run upgrades: pin the version in CI and disable auto-update.
// Example GitHub Actions step:
//   - run: npx gitnexus@1.14.0 analyze --embeddings   # pinned, immutable during the job

Try / catch

try {
  await runAnalysis();
} catch (err) {
  if (err instanceof Error && err.message.includes('refusing to stamp metadata')) {
    // Install changed mid-run: re-run once against the now-stable installation
    return runAnalysis();
  }
  throw err;
}

Prevention

When it happens

Trigger: A long analyze run during which the GitNexus installation changes: upgrading gitnexus mid-run, npm install rewriting node_modules, embeddings stack installing concurrently, or a dev watcher rebuilding dist/. At finalize time the re-resolved identity != startedWith.

Common situations: Auto-updaters or CI patching the tool during a job, a user running npm install -g gitnexus while an analyze/MCP session is active, or scheduled rebuild tasks overlapping long indexing runs on big repositories.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@52924ef12c (2026-08-20). Data as JSON: /api/errors/d1bd1bcf0e1a51e1. Report an issue: GitHub.

Appendix: source

Thrown at gitnexus/src/core/analyzer-identity.ts:2870

export async function captureAnalyzerIdentityBeforeLoad<T>(
  analyzerModuleUrl: string,
  loader: () => Promise<T>,
  options: AnalyzerIdentityResolveOptions = {},
): Promise<{ runnerIdentity: AnalyzerRunnerIdentity; loaded: T }> {
  const runnerIdentity = resolveAnalyzerRunnerIdentity(analyzerModuleUrl, options);
  const loaded = await loader();
  return { runnerIdentity, loaded };
}

/** Re-resolve immediately before commit and reject analyzer mutation mid-run. */
export function finalizeAnalyzerRunnerIdentity(
  analyzerModuleUrl: string,
  startedWith: AnalyzerRunnerIdentity,
  options: AnalyzerIdentityResolveOptions = {},
): AnalyzerRunnerIdentity {
  const finalIdentity = resolveAnalyzerRunnerIdentity(analyzerModuleUrl, options);
  if (!analyzerRunnerIdentitiesEqual(startedWith, finalIdentity)) {
    throw new Error(
      'Analyzer build or dependency runtime changed during analysis; refusing to stamp metadata. ' +
        'Retry with a stable GitNexus installation.',
    );
  }
  return finalIdentity;
}

View on GitHub (pinned to 52924ef12c)