abhigyanpatwari/GitNexus · error
GitNexus package version is unavailable in
Error message
GitNexus package version is unavailable in ${packageRoot} What it means
The analyzer runner identity embeds the GitNexus package version read from the first dependency package's package.json manifest (dependencyInputs.packages[0].manifest.version). If that field is missing or blank (after trim), identity computation refuses to proceed because a versionless identity cannot be compared or cached safely.
Solutions
- Install a real published release: npm install -g gitnexus@latest (the npm tarball always carries a version).
- If running from a git checkout, build and pack first (npm pack in gitnexus/) and install the resulting tarball.
- Restore the version field in <packageRoot>/package.json if you maintain a fork.
- Verify with node -p "require('<packageRoot>/package.json').version" that it prints a non-empty string.
Example fix
# before npm install -g github:yourorg/gitnexus # manifest rewritten, version lost npx gitnexus analyze # GitNexus package version is unavailable in /usr/lib/node_modules/gitnexus # after: install a published release cd gitnexus && npm pack && npm install -g gitnexus-<version>.tgz npx gitnexus analyze
Defensive patterns
Strategy: validation
Validate before calling
// Before running the CLI against an install, verify the manifest version:
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
function packageVersionPresent(packageRoot: string): boolean {
try {
const v = JSON.parse(readFileSync(join(packageRoot, 'package.json'), 'utf8')).version;
return typeof v === 'string' && v.trim() !== '';
} catch {
return false;
}
} Try / catch
try {
spawnSync('gitnexus', ['analyze']);
} catch (err) {
if (String((err as Error).message).includes('GitNexus package version is unavailable')) {
await reinstallPublishedRelease(); // npm install -g gitnexus@latest
return spawnSync('gitnexus', ['analyze']);
}
throw err;
} Prevention
- Install from the npm registry tarball, not github: URLs or raw file copies.
- If forking, keep the version field intact and bump it per release.
- In Docker builds, copy the packed .tgz rather than an ad-hoc source tree.
- Smoke-test installs with node -p "require('gitnexus/package.json').version".
When it happens
Trigger: resolveAnalyzerRunnerIdentity() where the root package.json of the resolved analyzer install lacks a version field, has version: '' or a whitespace-only value — typically a hand-copied or patched install, a git checkout consumed without the build/pack step, or a corrupted publish.
Common situations: Installing from a git URL (npm i github:org/gitnexus) where tooling rewrote package.json, Docker images that strip manifest metadata, internal forks that hand-edit the manifest, or file: installs of a partial package.
Related errors
- Invoked analyzer artifact is absent from the validated build
- Analyzer build changed while its identity was being computed
- Analyzer build or dependency runtime changed during…
- Analyzer build or dependency runtime changed while its…
- Analyzer build scan exceeded depth
AI-assisted analysis of abhigyanpatwari/GitNexus@52924ef12c (2026-08-20).
Data as JSON: /api/errors/62787b2f99ca582d.
Report an issue: GitHub.
Appendix: source
Thrown at gitnexus/src/core/analyzer-identity.ts:2753
rememberIdentityCache(previousCache);
return cachedIdentity;
}
}
}
const build = hashBuildTree(buildRoot, previousCache, options, traversalLimits);
const dependencyInputs = collectDependencyInputs(packageRoot, options, traversalLimits);
const dependencySnapshotBefore = dependencySnapshot(dependencyInputs);
const dependency = hashDependencyRuntime(
dependencyInputs,
previousCache,
options,
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 = {View on GitHub (pinned to 52924ef12c)