thedotmack/claude-mem · warning

Worker unavailable on Windows — skipping spawn (recent…

Error message

Worker unavailable on Windows — skipping spawn (recent attempt failed within cooldown)

What it means

On Windows, the spawner consults shouldSkipSpawnOnWindows(), which returns true if a recent spawn attempt failed within the cooldown window. Rather than retry-spawning a worker known to have just failed, ensureWorkerStarted logs this warning and returns 'dead' immediately.

Solutions

  1. Wait for the cooldown to expire and retry the operation
  2. Fix the underlying spawn failure (check that Bun and uv are installed and on PATH)
  3. Clear the spawn-attempted state / restart the machine if the flag is stale
  4. Run the worker manually once to surface the real boot error

Example fix

// before
if (shouldSkipSpawnOnWindows()) return 'dead';
// after
if (shouldSkipSpawnOnWindows()) {
  logger.warn('spawn skipped: cooldown active; clearing after manual fix');
  clearWorkerSpawnAttempted(); // once the root cause is fixed
}
Defensive patterns

Strategy: fallback

Validate before calling

if (process.platform === 'win32' && recentSpawnFailedWithinCooldown()) {
  console.warn('spawn gated by cooldown; run worker manually to see the real error');
}

Try / catch

const status = await ensureWorkerStarted(port);
if (status === 'dead' && process.platform === 'win32') {
  // fall back to non-worker path or surface setup instructions
}

Prevention

When it happens

Trigger: Worker is not running, a previous spawn attempt on Windows failed recently (recorded attempt flag within cooldown), and shouldSkipSpawnOnWindows() gates the spawn — common because Windows spawn/kill cycles are slower and flakier.

Common situations: Repeated hook invocations right after a worker crash on Windows; uv/Bun missing or slow on first run; antivirus locking the spawned binary; cooldown not yet expired after a failed boot.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17). Data as JSON: /api/errors/dce40710ae11e267. Report an issue: GitHub.

Appendix: source

Thrown at src/services/worker-spawner.ts:171

        port,
        killedPids: reclaim.killedPids,
      });
      // The cooldown marker may have been written by the very spawn attempts
      // this ghost blocked; the reason for those failures is now gone, so a
      // time-based cooldown would only delay the recovery that just became
      // possible (the plan-15 "cooldowns keyed to evidence, not time" rule).
      clearWorkerSpawnAttempted();
    } else {
      logger.error('SYSTEM', 'Port in use but worker not responding to health checks', {
        port,
        reclaimReason: reclaim.reason,
      });
      return 'dead';
    }
  }

  if (shouldSkipSpawnOnWindows()) {
    logger.warn('SYSTEM', 'Worker unavailable on Windows — skipping spawn (recent attempt failed within cooldown)');
    return 'dead';
  }

  // Spawn gate (src/shared/worker-spawn-gate.ts): only ONE gated launcher —
  // hook, MCP server, or the CLI restart fallback — may spawn at a time. (The
  // dying worker's restart handoff in worker-shutdown.ts is deliberately NOT
  // gated: it is the primary spawner on restart, and hooks wait for its
  // successor.) Losing the lock never fails this path; the loser skips its
  // spawn and waits for the holder's worker. The winner holds the lock through
  // the readiness wait and releases it in finally on every exit path.
  const spawnLockHeld = acquireSpawnLock();
  let spawnedPid: number | undefined;
  try {
    if (spawnLockHeld) {
      logger.info('SYSTEM', 'Starting worker daemon', { workerScriptPath });
      markWorkerSpawnAttempted();
      spawnedPid = spawnDaemon(workerScriptPath, port);
      if (spawnedPid === undefined) {

View on GitHub (pinned to d8bc9755e7)