{"record":{"id":"4702d82867cc30bc","repo":"abhigyanpatwari/GitNexus","slug":"invoked-analyzer-artifact-is-absent-from-the-valid","errorCode":null,"errorMessage":"Invoked analyzer artifact is absent from the validated build: ${invokedArtifactPath}","messagePattern":"Invoked analyzer artifact is absent from the validated build: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/analyzer-identity.ts","lineNumber":2769,"sourceCode":"    packageVersion,\n    buildKind: kind,\n    buildCanonicalization: BUILD_CANONICALIZATION,\n    dependencyCanonicalization: DEPENDENCY_RUNTIME_CANONICALIZATION,\n    traversalLimits,\n    runtimeVariant,\n    buildRootState: build.rootState,\n    buildDigest: build.digest,\n    buildEntries: build.entries,\n    buildDirectoryGuards: build.directoryGuards,\n    dependencyIdentity: dependency.identity,\n    dependencyFileGuards: dependencyFileGuards(dependencyInputs),\n    dependencyDirectoryGuards: dependencyDirectoryGuards(dependencyInputs),\n    dependencyPathGuards: dependencyPathGuards(dependencyInputs),\n    artifactEntries: dependency.entries,\n  };\n  const invokedDigest = cachedBuildDigestForPath(nextCache, invokedArtifactPath);\n  if (!invokedDigest) {\n    throw new Error(\n      `Invoked analyzer artifact is absent from the validated build: ${invokedArtifactPath}`,\n    );\n  }\n  const identity: AnalyzerRunnerIdentity = {\n    schemaVersion: ANALYZER_RUNNER_IDENTITY_SCHEMA_VERSION,\n    runtime: runnerRuntimeIdentity(runtimeVariant),\n    cliVersion: packageVersion,\n    invokedArtifact: {\n      path: invokedArtifactPath,\n      digest: invokedDigest,\n    },\n    build: {\n      kind,\n      rootPath: buildRoot,\n      canonicalization: BUILD_CANONICALIZATION,\n      digest: build.digest,\n    },\n    dependencyRuntime: dependency.identity,","sourceCodeStart":2751,"sourceCodeEnd":2787,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/core/analyzer-identity.ts#L2751-L2787","documentation":"Thrown by resolveAnalyzerRunnerIdentity when the invoked analyzer artifact path (derived from process.argv[1] if it is inside buildRoot, else the analyzerModulePath) is not found among the validated build entries. cachedBuildDigestForPath returns null when the path is not isInside(buildRoot) or no build entry of kind 'file' matches its relative path. The identity cannot be issued without a digest for the very module being executed.","triggerScenarios":"After the build is hashed and the nextCache assembled, cachedBuildDigestForPath(nextCache, invokedArtifactPath) is called. It returns null if invokedArtifactPath is outside buildRoot, or if its relativePath does not match any buildEntries file (e.g. the entry was pruned, the path points at a source file outside the build output, or buildRoot was mis-resolved).","commonSituations":"Invoking the analyzer from its TypeScript source (via tsx/ts-node) so analyzerModulePath points at `src/...` while buildRoot was resolved as `dist/`; running a stale shim whose target moved; a buildRoot that was resolved from a symlinked location so isInside returns false; an artifact path with a `..` traversal that resolves outside buildRoot; running the analyzer after `tsc` but pointing at the pre-build source.","solutions":["Invoke the analyzer from its built artifact, not its source: `node dist/cli.js` (or the published bin) instead of `tsx src/cli.ts`.","Confirm invokedArtifactPath is inside buildRoot: `node -e \"console.log(require('path').relative('<buildRoot>','<artifact>'))\"` should yield a non-`..` relative path.","Rebuild so the artifact exists in the build output: `npm run build` then retry.","If using a symlinked bin, ensure the resolved real path still lies under buildRoot."],"exampleFix":"// before: invoking source via tsx\n//   $ tsx gitnexus/src/cli.ts analyze\n//   -> \"Invoked analyzer artifact is absent from the validated build: /repo/gitnexus/src/cli.ts\"\n//\n// after: invoke the built artifact\n//   $ npm --prefix gitnexus run build\n//   $ node gitnexus/dist/cli.js analyze","handlingStrategy":"validation","validationCode":"const fs = require('node:fs');\nconst path = require('node:path');\nfunction assertInvokedArtifactInBuild(buildRoot, analyzerModuleUrl) {\n  const { fileURLToPath } = require('node:url');\n  const analyzerPath = path.resolve(fileURLToPath(analyzerModuleUrl));\n  const buildResolved = path.resolve(buildRoot);\n  const rel = path.relative(buildResolved, analyzerPath);\n  if (rel === '' || rel.startsWith('..') || path.isAbsolute(rel)) {\n    throw new Error(`Analyzer module ${analyzerPath} is not under build root ${buildResolved}; invoke the built artifact.`);\n  }\n  const st = fs.lstatSync(analyzerPath);\n  if (!st.isFile()) throw new Error(`${analyzerPath} is not a regular file`);\n}\n// assertInvokedArtifactInBuild(buildRoot, import.meta.url);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Invoke the analyzer from its built artifact (dist/...), not its source (src/...).","Run `npm run build` before invoking; do not run via tsx/ts-node against source for identity resolution.","Ensure symlinked bins resolve to a real path inside buildRoot.","Confirm process.argv[1] (the entry) is the built file when relying on the default invoked-artifact resolution."],"tags":["analyzer-identity","build","invoked-artifact","misconfiguration"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}