diegosouzapw/OmniRoute · error

[SESSION_AFFINITY] Startup cleanup failed:

Error message

[SESSION_AFFINITY] Startup cleanup failed:

What it means

Error "[SESSION_AFFINITY] Startup cleanup failed:" thrown in diegosouzapw/OmniRoute.

Source

Thrown at src/lib/db/sessionAccountAffinity.ts:195

      const record = parseRecord(row.value);
      if (!record || Date.parse(record.expiresAt) <= now) {
        db.prepare("DELETE FROM key_value WHERE namespace = ? AND key = ?").run(NAMESPACE, row.key);
        deleted++;
      }
    }
  });

  tx();
  return deleted;
}

export function startSessionAccountAffinityCleanup(): void {
  if (cleanupTimer) return;

  try {
    cleanupStaleSessionAccountAffinities();
  } catch (error) {
    console.warn("[SESSION_AFFINITY] Startup cleanup failed:", error);
  }

  cleanupTimer = setInterval(() => {
    try {
      cleanupStaleSessionAccountAffinities();
    } catch (error) {
      console.warn("[SESSION_AFFINITY] Periodic cleanup failed:", error);
    }
  }, CLEANUP_INTERVAL_MS);
  if (typeof cleanupTimer === "object" && "unref" in cleanupTimer) cleanupTimer.unref?.();
}

export function stopSessionAccountAffinityCleanupForTests(): void {
  if (!cleanupTimer) return;
  clearInterval(cleanupTimer);
  cleanupTimer = null;
}

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/lib/db/sessionAccountAffinity.ts:195 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/c3e241d2a44ee9a3. Report an issue: GitHub.