abhigyanpatwari/GitNexus · error · WorkerPoolInitializationError

Worker pool has no active workers${detail}

Error message

Worker pool has no active workers${detail}

What it means

Thrown by `dispatch()` as a `WorkerPoolInitializationError` when `activeSlots.size === 0` after the initial readiness gate settles — meaning every initial worker failed its `{type:'ready'}` handshake and the bounded self-heal (respawn) exhausted its retry budget. The pool auto-classifies the crash via `crashClass`: `'deterministic-startup'` (>=2 workers crashed with the SAME signature, e.g. a missing native binding — retry is futile, short-circuited fast) or `'transient-exhausted'` (variable crashes that burned the retry budget). The `readinessFailures` array carries each slot's failure detail.

Source

Thrown at gitnexus/src/core/ingestion/workers/worker-pool.ts:1300

      throw new WorkerPoolDispatchError(
        `Worker pool circuit breaker tripped${reason}. ` +
          `Subsequent dispatches require a fresh pool instance.`,
        [],
      );
    }
    if (items.length === 0) return [];
    if (activeSlots.size === 0) {
      const detail =
        initialReadinessFailures.length > 0
          ? ` after initial ready handshake: ${initialReadinessFailures.join('; ')}`
          : '';
      // The bounded self-heal exhausted (or short-circuited a deterministic
      // crash-loop). Classify automatically so the caller renders the real
      // cause without consulting any operator flag (#1741).
      const crashClass: StartupCrashClass = deterministicStartupDetected
        ? 'deterministic-startup'
        : 'transient-exhausted';
      throw new WorkerPoolInitializationError(
        `Worker pool has no active workers${detail}`,
        [],
        initialReadinessFailures,
        crashClass,
      );
    }

    // Layer 3: filter out quarantined paths so a known-bad file never reaches
    // a worker again this pool lifetime. The caller queries
    // `getQuarantinedPaths` after dispatch to route filtered items.
    const dispatchableItems: TInput[] = [];
    for (const item of items) {
      const path = itemPath(item);
      if (path !== undefined && quarantine.has(path)) continue;
      dispatchableItems.push(item);
    }
    if (dispatchableItems.length === 0) return [];

View on GitHub (pinned to d540b00184)

Solutions

  1. Read `error.crashClass`: if `'deterministic-startup'`, inspect `error.readinessFailures` for the repeated signature and fix the environment (rebuild/install native bindings, fix the missing dep).
  2. If `'transient-exhausted'`, raise resource limits (`ulimit -n`, container fd/memory caps) and retry with a fresh pool.
  3. Reinstall/rebuild the GitNexus package so the worker's native dependencies resolve.
  4. Reduce `workerPoolSize` (e.g. `--workers 2`) to lower per-spawn resource pressure if the host is constrained.
Defensive patterns

Strategy: retry

Type guard

import { WorkerPoolInitializationError } from 'gitnexus/dist/core/ingestion/workers/worker-pool.js';

function isInitFailure(err): err is WorkerPoolInitializationError {
  return err instanceof WorkerPoolInitializationError;
}

function isDeterministic(err): boolean {
  return err instanceof WorkerPoolInitializationError
    && err.crashClass === 'deterministic-startup';
}

Try / catch

import { WorkerPoolInitializationError } from 'gitnexus/dist/core/ingestion/workers/worker-pool.js';

try {
  await pool.dispatch(items);
} catch (err) {
  if (err instanceof WorkerPoolInitializationError) {
    if (err.crashClass === 'transient-exhausted') {
      // retry with a fresh pool after raising resource limits
      pool = createWorkerPool(url);
      await pool.dispatch(items);
    } else {
      // deterministic-startup: fix the env (native binding) — do NOT retry blindly
      console.error('Deterministic worker crash:', err.readinessFailures);
      throw err;
    }
  } else throw err;
}

Prevention

When it happens

Trigger: All initial workers fail readiness: a missing/incompatible native binding (deterministic-startup), a broken worker script top-of-file init crash, or transient resource exhaustion (fd/memory limits) that exhausted the bounded respawn budget (`workerReadyTimeoutMs` / retry count).

Common situations: A platform where the vendored tree-sitter native binding did not install/load (deterministic-startup); a CI box with a low `ulimit -n` starving workers of fds (transient); a worker script that throws at import time due to a bad env or missing dep.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12). Data as JSON: /api/errors/601545e63d0ddfb7. Report an issue: GitHub.