abhigyanpatwari/GitNexus · error

Invoked analyzer artifact is absent from the validated build

Error message

Invoked analyzer artifact is absent from the validated build: ${invokedArtifactPath}

What it means

The runner identity must pin the digest of the exact artifact (CLI entry module) currently being executed. That digest is looked up in the freshly computed cache of build entries; if invokedArtifactPath has no cached digest, the running code is not part of the build tree that was just validated — meaning the process is executing from somewhere other than the validated installation (or path canonicalization mismatched).

Solutions

  1. Restart the CLI/MCP session so it loads from the current install (old handles keep old paths alive).
  2. Clear the npx cache and invoke the installed binary directly: npm install -g gitnexus@latest && gitnexus analyze.
  3. Remove duplicate/stray copies of the package so exactly one install is on disk.
  4. Avoid launching via symlinked shims that resolve outside the real package tree.

Example fix

# before: npx uses a stale cache after an upgrade
npx gitnexus analyze
# Invoked analyzer artifact is absent from the validated build: /home/u/.npm/_npx/.../dist/cli.js

# after: run the freshly installed global binary
npx clear-npx-cache 2>/dev/null || rm -rf ~/.npm/_npx
npm install -g gitnexus@latest
gitnexus analyze
Defensive patterns

Strategy: fallback

Validate before calling

// Before spawning, confirm the module you invoke belongs to the install you think:
import { realpathSync } from 'node:fs';
function moduleInsideInstall(modulePath: string, installRoot: string): boolean {
  const real = realpathSync(modulePath);
  return real.startsWith(realpathSync(installRoot) + '/');
}
if (!moduleInsideInstall(cliEntry, installRoot)) await reinstallPublishedRelease();

Try / catch

try {
  await analyze({ repo: '.' });
} catch (err) {
  if (err instanceof Error && err.message.includes('absent from the validated build')) {
    // Stale handle on an upgraded install: restart the process and use the installed binary
    throw new Error('Restart the CLI/MCP session; it is executing from a removed artifact');
  }
  throw err;
}

Prevention

When it happens

Trigger: resolveAnalyzerRunnerIdentity(analyzerModuleUrl, ...) where the module URL resolves to a path absent from the validated build entries: running from a stray copy of the CLI (npx cache of an old version, a moved directory), import.meta.url disagreeing with the on-disk build layout after a reinstall, or a symlinked bin shim pointing outside the hashed build root.

Common situations: npx running a stale cached package while a new version was installed globally, upgrading gitnexus while a long-lived MCP server/session still references old files, or invoking through a custom wrapper that loads the module from a copied tree.

Related errors


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

Appendix: source

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

    packageVersion,
    buildKind: kind,
    buildCanonicalization: BUILD_CANONICALIZATION,
    dependencyCanonicalization: DEPENDENCY_RUNTIME_CANONICALIZATION,
    traversalLimits,
    runtimeVariant,
    buildRootState: build.rootState,
    buildDigest: build.digest,
    buildEntries: build.entries,
    buildDirectoryGuards: build.directoryGuards,
    dependencyIdentity: dependency.identity,
    dependencyFileGuards: dependencyFileGuards(dependencyInputs),
    dependencyDirectoryGuards: dependencyDirectoryGuards(dependencyInputs),
    dependencyPathGuards: dependencyPathGuards(dependencyInputs),
    artifactEntries: dependency.entries,
  };
  const invokedDigest = cachedBuildDigestForPath(nextCache, invokedArtifactPath);
  if (!invokedDigest) {
    throw new Error(
      `Invoked analyzer artifact is absent from the validated build: ${invokedArtifactPath}`,
    );
  }
  const identity: AnalyzerRunnerIdentity = {
    schemaVersion: ANALYZER_RUNNER_IDENTITY_SCHEMA_VERSION,
    runtime: runnerRuntimeIdentity(runtimeVariant),
    cliVersion: packageVersion,
    invokedArtifact: {
      path: invokedArtifactPath,
      digest: invokedDigest,
    },
    build: {
      kind,
      rootPath: buildRoot,
      canonicalization: BUILD_CANONICALIZATION,
      digest: build.digest,
    },
    dependencyRuntime: dependency.identity,

View on GitHub (pinned to 52924ef12c)