---
title: failover_detector | CodeWeaver Docs
description: API reference for codeweaver.engine.config.failover_detector
url: "https://docs.knitli.com/api/engine/config/failover_detector"
type: static
generatedAt: "2026-04-17T17:21:08.483Z"
---

# failover_detector
       [Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fengine%2Fconfig%2Ffailover_detector%2F.%20I%20want%20to%20ask%20questions%20about%20it.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fengine%2Fconfig%2Ffailover_detector%2F.%20I%20want%20to%20ask%20questions%20about%20it.)[View in Markdown](/codeweaver/api/engine/config/failover_detector.md)       [Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fengine%2Fconfig%2Ffailover_detector%2F)[Share on X](https://x.com/intent/tweet?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fengine%2Fconfig%2Ffailover_detector%2F&text=failover_detector)[Share on Threads](https://threads.net/intent/post?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fengine%2Fconfig%2Ffailover_detector%2F&text=failover_detector)[Share on Bluesky](https://bsky.app/intent/compose?text=failover_detector%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fengine%2Fconfig%2Ffailover_detector%2F)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fengine%2Fconfig%2Ffailover_detector%2F)[Share on Reddit](https://reddit.com/submit?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fengine%2Fconfig%2Ffailover_detector%2F&title=failover_detector)[Share on Hacker News](https://news.ycombinator.com/submitlink?u=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fengine%2Fconfig%2Ffailover_detector%2F&t=failover_detector)[Share on Email](mailto:?subject=failover_detector&body=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fengine%2Fconfig%2Ffailover_detector%2F)[Share on WhatsApp](https://wa.me/?text=failover_detector%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fengine%2Fconfig%2Ffailover_detector%2F)[Share on Telegram](https://t.me/share/url?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fengine%2Fconfig%2Ffailover_detector%2F&text=failover_detector)
# `codeweaver.engine.config.failover_detector`
[Section titled “codeweaver.engine.config.failover_detector”](#codeweaverengineconfigfailover_detector)
Failover detector abstraction to break circular dependency with ProviderSettings.

## Class: `FailoverDetector`
[Section titled “Class: FailoverDetector”](#class-failoverdetector)
Abstract interface for detecting whether failover should be disabled.

This abstraction breaks the circular dependency between FailoverSettings and ProviderSettings by inverting the dependency. FailoverSettings depends on this abstract interface, while concrete implementations depend on ProviderSettings.

The detector pattern follows the Dependency Inversion Principle (SOLID), allowing high-level failover logic to remain independent of provider configuration details.

### Method: `should_disable_failover`
[Section titled “Method: should_disable_failover”](#method-should_disable_failover)

**

```
should_disable_failover()
```

Determine whether failover should be automatically disabled.

Returns: True if failover should be disabled based on provider configuration, False otherwise.

## Class: `LocalEmbeddingDetector`
[Section titled “Class: LocalEmbeddingDetector”](#class-localembeddingdetector)
Detect whether to disable failover based on local embedding provider.

This implementation disables failover when the primary embedding provider is local, as local providers don’t require network failover mechanisms.

The detector is registered with the DI container to provide the FailoverDetector interface, enabling automatic injection into consumers.

### Method: `should_disable_failover`
[Section titled “Method: should_disable_failover”](#method-should_disable_failover-1)

**

```
should_disable_failover()
```

Check if the primary embedding provider is local.

Failover is automatically disabled when:

 - The embedding provider list is non-empty AND
 - The first (primary) embedding provider is marked as local

If no embedding providers are configured (empty list), failover remains enabled as a safety measure.

Returns: True if the primary embedding provider is local and failover should be disabled, False otherwise.