abhigyanpatwari/GitNexus · info

Auto-sync run cancelled.

Error message

Auto-sync run cancelled.

What it means

throwIfAborted raises a plain Error('Auto-sync run cancelled.') when the AbortSignal passed to an auto-sync run has fired. runAutoSyncOnce, repoResults, and the per-item runners check it at cancellation points so an aborted run stops promptly instead of continuing work.

Source

Thrown at gitnexus/src/core/auto-sync/runner.ts:505

      nextIndex += 1;
      results[currentIndex] = await worker(items[currentIndex]);
      throwIfAborted(signal);
    }
  });
  // Settle every runner before surfacing a failure. Promise.all rejects on the
  // first error while siblings are still inside a clone or waiting on an
  // analyze fork, and the caller treats that rejection as "the run is over" —
  // it releases the watch mutex and exits, orphaning those children. Each
  // runner already refuses new work at the abort check above, so waiting here
  // costs nothing on the cancel path.
  const settlements = await Promise.allSettled(runners);
  const failure = settlements.find((s) => s.status === 'rejected');
  if (failure) throw (failure as PromiseRejectedResult).reason;
  return results;
}

function throwIfAborted(signal: AbortSignal | undefined): void {
  if (signal?.aborted) throw new Error('Auto-sync run cancelled.');
}

interface AutoSyncWorkItem {
  project: AutoSyncProjectConfig;
  remoteUrl: string;
  cloneRoot?: Awaited<ReturnType<typeof resolveConfiguredCloneRoot>>;
  repoName?: string;
  targetDir?: string;
  error?: string;
}

async function syncFirstAvailableBranch(input: {
  item: AutoSyncWorkItem;
  repoName: string;
  targetDir: string;
  timeoutMs: number;
  deps: AutoSyncRunDeps;
  logger: AutoSyncLogger;

View on GitHub (pinned to 0d1aed942f)

Solutions

  1. Treat this error as expected control flow: catch it and skip cleanup-as-failure reporting.
  2. Re-run the auto-sync with a fresh, non-aborted AbortSignal (and a longer timeout if applicable).
  3. If you did not intend cancellation, check what is aborting the signal (timeout, signal handler) before retrying.

Example fix

// before
await runAutoSyncOnce(config, signal); // crashes reporting as error

// after
try {
  await runAutoSyncOnce(config, signal);
} catch (err) {
  if (signal?.aborted) return; // expected cancellation
  throw err;
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (signal?.aborted) return; // skip the run entirely before starting

Try / catch

try {
  await runAutoSyncOnce(config, signal);
} catch (err) {
  if (err instanceof Error && err.message === 'Auto-sync run cancelled.') return; // expected
  throw err;
}

Prevention

When it happens

Trigger: Calling runAutoSyncOnce (or its internals repoResults/runners) with an AbortSignal that is already aborted, or aborting the signal mid-run at a checkpoint.

Common situations: User presses Ctrl-C / cancels a long auto-sync run from the UI; a timeout wrapper aborts the signal; a shutdown hook aborts pending sync work.

Related errors


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