abhigyanpatwari/GitNexus · error · Error

No target path resolved

Error message

No target path resolved

What it means

Defensive invariant in POST /api/analyze's async worker (api.ts ~1592): targetPath starts as the request's repoLocalPath and is only overwritten when a repoUrl clone runs. If both are falsy — request body carried neither a usable absolute 'path' nor a 'url' — the guard throws so the job is failed with a clear message instead of launching a worker against nothing.

Source

Thrown at gitnexus/src/server/api.ts:1618

        (async () => {
          let targetPath = repoLocalPath;
          try {
            // Clone if URL provided
            if (repoUrl && !repoLocalPath) {
              const repoName = extractWebRepoName(repoUrl);
              targetPath = getCloneDir(repoName);

              jobManager.updateJob(job.id, {
                status: 'cloning',
                repoName,
                progress: { phase: 'cloning', percent: 0, message: `Cloning ${repoUrl}...` },
              });

              await cloneOrPull(
                repoUrl,
                targetPath,
                (progress) => {
                  jobManager.updateJob(job.id, {
                    progress: { phase: progress.phase, percent: 5, message: progress.message },
                  });
                },
                repoToken ? { token: repoToken } : undefined,
              );
            }

            if (!targetPath) {
              throw new Error('No target path resolved');
            }

            launchAnalysisWorker(job, targetPath, {
              force,
              embeddings,
              dropEmbeddings,
              springActuatorPath,
              asyncApiSpecPath,
            });

View on GitHub (pinned to 0d1aed942f)

Solutions

  1. Include exactly one of: absolute filesystem 'path' or https/http 'url' ending in the repo name
  2. Require at least one of the two fields in the client before submitting
  3. Check the request body serialization (undefined values dropped by JSON.stringify)

Example fix

// before
await fetch('/api/analyze', { method: 'POST', body: JSON.stringify({}) });

// after
await fetch('/api/analyze', {
  method: 'POST',
  body: JSON.stringify({ url: 'https://github.com/user/repo.git' }),
});
Defensive patterns

Strategy: validation

Validate before calling

function validAnalyzeBody(b) {
  const hasUrl = typeof b.url === 'string' && b.url.trim().length > 0;
  const hasPath = typeof b.path === 'string' && b.path.trim().length > 0;
  return hasUrl !== hasPath; // exactly one
}

Type guard

function isNonEmptyTargetSpec(b) {
  return Boolean((typeof b?.url === 'string' && b.url) || (typeof b?.path === 'string' && b.path));
}

Try / catch

// server-side job error carries 'No target path resolved'; treat as non-retryable client error
if (job.error === 'No target path resolved') fixRequestBodyAndResubmit();

Prevention

When it happens

Trigger: POST /api/analyze with an empty body {}, with path:'' and no url, or url:null — any combination that slips past earlier field checks yet leaves targetPath falsy when the worker starts.

Common situations: Client submits an unvalidated form where both fields are optional and both were left blank; a renamed API field ('repo' vs 'url') silently sending nothing; scripted calls with an empty JSON object.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@0d1aed942f (2026-08-20). Data as JSON: /api/errors/fd9d3089a449f5db. Report an issue: GitHub.