{"record":{"id":"62787b2f99ca582d","repo":"abhigyanpatwari/GitNexus","slug":"gitnexus-package-version-is-unavailable-in-packa","errorCode":null,"errorMessage":"GitNexus package version is unavailable in ${packageRoot}","messagePattern":"GitNexus package version is unavailable in (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/analyzer-identity.ts","lineNumber":2753,"sourceCode":"        rememberIdentityCache(previousCache);\n        return cachedIdentity;\n      }\n    }\n  }\n\n  const build = hashBuildTree(buildRoot, previousCache, options, traversalLimits);\n  const dependencyInputs = collectDependencyInputs(packageRoot, options, traversalLimits);\n  const dependencySnapshotBefore = dependencySnapshot(dependencyInputs);\n  const dependency = hashDependencyRuntime(\n    dependencyInputs,\n    previousCache,\n    options,\n    runtimeVariant,\n  );\n\n  const packageVersion = dependencyInputs.packages[0]?.manifest.version;\n  if (typeof packageVersion !== 'string' || packageVersion.trim() === '') {\n    throw new Error(`GitNexus package version is unavailable in ${packageRoot}`);\n  }\n\n  const buildSnapshotAfter = buildSnapshot(\n    collectBuildEntries(buildRoot, options, traversalLimits),\n  );\n  if (!isDeepStrictEqual(build.snapshot, buildSnapshotAfter)) {\n    throw new Error(`Analyzer build changed while its identity was being computed: ${buildRoot}`);\n  }\n  const dependencySnapshotAfter = dependencySnapshot(\n    collectDependencyInputs(packageRoot, options, traversalLimits),\n  );\n  if (!isDeepStrictEqual(dependencySnapshotBefore, dependencySnapshotAfter)) {\n    throw new Error(\n      `Analyzer dependency runtime changed while its identity was being computed: ${packageRoot}`,\n    );\n  }\n\n  const nextCache: IdentityCachePayload = {","sourceCodeStart":2735,"sourceCodeEnd":2771,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/52924ef12c2290ceee4612526a828ec4cdf2047f/gitnexus/src/core/analyzer-identity.ts#L2735-L2771","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nnpm install -g github:yourorg/gitnexus   # manifest rewritten, version lost\nnpx gitnexus analyze\n# GitNexus package version is unavailable in /usr/lib/node_modules/gitnexus\n\n# after: install a published release\ncd gitnexus && npm pack && npm install -g gitnexus-<version>.tgz\nnpx gitnexus analyze","handlingStrategy":"validation","validationCode":"// Before running the CLI against an install, verify the manifest version:\nimport { readFileSync } from 'node:fs';\nimport { join } from 'node:path';\nfunction packageVersionPresent(packageRoot: string): boolean {\n  try {\n    const v = JSON.parse(readFileSync(join(packageRoot, 'package.json'), 'utf8')).version;\n    return typeof v === 'string' && v.trim() !== '';\n  } catch {\n    return false;\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  spawnSync('gitnexus', ['analyze']);\n} catch (err) {\n  if (String((err as Error).message).includes('GitNexus package version is unavailable')) {\n    await reinstallPublishedRelease(); // npm install -g gitnexus@latest\n    return spawnSync('gitnexus', ['analyze']);\n  }\n  throw err;\n}","preventionTips":["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\"."],"tags":["analyzer-identity","package-manifest","installation","version"],"backgroundTag":"invalid-package-manifest","analyzedSha":"52924ef12c2290ceee4612526a828ec4cdf2047f","analyzedAt":"2026-08-20T23:29:22.980Z","contentChangedAt":"2026-08-20T23:29:22.980Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}