{"record":{"id":"601545e63d0ddfb7","repo":"abhigyanpatwari/GitNexus","slug":"worker-pool-has-no-active-workers-detail","errorCode":null,"errorMessage":"Worker pool has no active workers${detail}","messagePattern":"Worker pool has no active workers(.+?)","errorType":"exception","errorClass":"WorkerPoolInitializationError","httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/ingestion/workers/worker-pool.ts","lineNumber":1300,"sourceCode":"      throw new WorkerPoolDispatchError(\n        `Worker pool circuit breaker tripped${reason}. ` +\n          `Subsequent dispatches require a fresh pool instance.`,\n        [],\n      );\n    }\n    if (items.length === 0) return [];\n    if (activeSlots.size === 0) {\n      const detail =\n        initialReadinessFailures.length > 0\n          ? ` after initial ready handshake: ${initialReadinessFailures.join('; ')}`\n          : '';\n      // The bounded self-heal exhausted (or short-circuited a deterministic\n      // crash-loop). Classify automatically so the caller renders the real\n      // cause without consulting any operator flag (#1741).\n      const crashClass: StartupCrashClass = deterministicStartupDetected\n        ? 'deterministic-startup'\n        : 'transient-exhausted';\n      throw new WorkerPoolInitializationError(\n        `Worker pool has no active workers${detail}`,\n        [],\n        initialReadinessFailures,\n        crashClass,\n      );\n    }\n\n    // Layer 3: filter out quarantined paths so a known-bad file never reaches\n    // a worker again this pool lifetime. The caller queries\n    // `getQuarantinedPaths` after dispatch to route filtered items.\n    const dispatchableItems: TInput[] = [];\n    for (const item of items) {\n      const path = itemPath(item);\n      if (path !== undefined && quarantine.has(path)) continue;\n      dispatchableItems.push(item);\n    }\n    if (dispatchableItems.length === 0) return [];\n","sourceCodeStart":1282,"sourceCodeEnd":1318,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/core/ingestion/workers/worker-pool.ts#L1282-L1318","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["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).","If `'transient-exhausted'`, raise resource limits (`ulimit -n`, container fd/memory caps) and retry with a fresh pool.","Reinstall/rebuild the GitNexus package so the worker's native dependencies resolve.","Reduce `workerPoolSize` (e.g. `--workers 2`) to lower per-spawn resource pressure if the host is constrained."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":"import { WorkerPoolInitializationError } from 'gitnexus/dist/core/ingestion/workers/worker-pool.js';\n\nfunction isInitFailure(err): err is WorkerPoolInitializationError {\n  return err instanceof WorkerPoolInitializationError;\n}\n\nfunction isDeterministic(err): boolean {\n  return err instanceof WorkerPoolInitializationError\n    && err.crashClass === 'deterministic-startup';\n}","tryCatchPattern":"import { WorkerPoolInitializationError } from 'gitnexus/dist/core/ingestion/workers/worker-pool.js';\n\ntry {\n  await pool.dispatch(items);\n} catch (err) {\n  if (err instanceof WorkerPoolInitializationError) {\n    if (err.crashClass === 'transient-exhausted') {\n      // retry with a fresh pool after raising resource limits\n      pool = createWorkerPool(url);\n      await pool.dispatch(items);\n    } else {\n      // deterministic-startup: fix the env (native binding) — do NOT retry blindly\n      console.error('Deterministic worker crash:', err.readinessFailures);\n      throw err;\n    }\n  } else throw err;\n}","preventionTips":["Ensure the vendored tree-sitter native binding installs/loads for your platform.","Raise `ulimit -n` and container fd/memory caps before running analyze.","Read `crashClass` before retrying — retrying a deterministic-startup failure wastes time."],"tags":["worker-pool","startup","initialization","native-binding","resilience"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}