abhigyanpatwari/GitNexus · error

Analyzer dependency runtime changed while its identity was…

Error message

Analyzer dependency runtime changed while its identity was being computed: ${packageRoot}

What it means

Companion to the build-tree race check: dependency inputs (manifests, lockfiles, runtime artifacts) are snapshotted before hashing and re-collected after. A deep-strict inequality means the dependency runtime mutated mid-computation (new node_modules content, lockfile rewrite, vendor/ change), so the identity is discarded with this error naming the package root.

Solutions

  1. Let any in-flight install finish, then re-run analyze — the retry on a quiescent tree succeeds.
  2. Run `gitnexus embeddings install` as its own completed step before analyze --embeddings rather than concurrently.
  3. Serialize CI jobs that share the installation directory (or give each job its own container/image layer).
  4. After a crashed install, reinstall cleanly so no watcher 'finishes' writes during analysis.

Example fix

# before: parallel CI steps share the install
- run: gitnexus embeddings install &
- run: npx gitnexus analyze --embeddings
# Analyzer dependency runtime changed while its identity was being computed

# after: sequential steps
- run: gitnexus embeddings install
- run: npx gitnexus analyze --embeddings
Defensive patterns

Strategy: retry

Validate before calling

// Check nothing is mutating node_modules before analyze:
import { execSync } from 'node:child_process';
function noConcurrentInstall(): boolean {
  try {
    const ps = execSync('ps ax -o command=', { encoding: 'utf8' });
    return !/(npm|pnpm|yarn|bun)\s+(i|install|ci|update)/.test(ps);
  } catch {
    return true;
  }
}

Try / catch

try {
  await analyze({ repo: '.', embeddings: true });
} catch (err) {
  if (err instanceof Error && /dependency runtime changed while its identity was being computed/.test(err.message)) {
    await waitForInstallsToFinish();
    return analyze({ repo: '.', embeddings: true });
  }
  throw err;
}

Prevention

When it happens

Trigger: resolveAnalyzerRunnerIdentity() where between dependencySnapshot() calls something changes dependency inputs — npm install running concurrently, npm audit fix rewriting package-lock.json, a postinstall script materializing vendored grammars into node_modules, or an embeddings install adding the ONNX stack mid-analysis.

Common situations: `gitnexus embeddings install` racing an analyze (the analyzer auto-installs the optional stack with --embeddings), two CI jobs sharing an install directory, npm cache pruning touching the tree, or a partially completed install from a previous crashed run finishing via file watcher.

Related errors


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

Appendix: source

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

    runtimeVariant,
  );

  const packageVersion = dependencyInputs.packages[0]?.manifest.version;
  if (typeof packageVersion !== 'string' || packageVersion.trim() === '') {
    throw new Error(`GitNexus package version is unavailable in ${packageRoot}`);
  }

  const buildSnapshotAfter = buildSnapshot(
    collectBuildEntries(buildRoot, options, traversalLimits),
  );
  if (!isDeepStrictEqual(build.snapshot, buildSnapshotAfter)) {
    throw new Error(`Analyzer build changed while its identity was being computed: ${buildRoot}`);
  }
  const dependencySnapshotAfter = dependencySnapshot(
    collectDependencyInputs(packageRoot, options, traversalLimits),
  );
  if (!isDeepStrictEqual(dependencySnapshotBefore, dependencySnapshotAfter)) {
    throw new Error(
      `Analyzer dependency runtime changed while its identity was being computed: ${packageRoot}`,
    );
  }

  const nextCache: IdentityCachePayload = {
    schemaVersion: IDENTITY_CACHE_SCHEMA_VERSION,
    packageRoot,
    buildRoot,
    packageVersion,
    buildKind: kind,
    buildCanonicalization: BUILD_CANONICALIZATION,
    dependencyCanonicalization: DEPENDENCY_RUNTIME_CANONICALIZATION,
    traversalLimits,
    runtimeVariant,
    buildRootState: build.rootState,
    buildDigest: build.digest,
    buildEntries: build.entries,
    buildDirectoryGuards: build.directoryGuards,

View on GitHub (pinned to 52924ef12c)