<!-- Source: @site/projects/sqlens-for-laravel/docs/rules/cap-l0-ambiguous-read-hosts.md -->
<!-- Canonical: https://docs.pushery.com/sqlens-for-laravel/rules/cap-l0-ambiguous-read-hosts/ -->

# CAP.L0.AMBIGUOUS_READ_HOSTS — the connection offers several read hosts and nothing chose

> Laravel picks a read host at random. An audit that accepted that would describe a different server on different runs.

- **Category:** safety
- **Level:** 0
- **Stability:** stable
- **Suites:** audit

One connection, several read hosts. Laravel resolves that by **choosing at random**: it shuffles the
host list and picks the read and write sides independently, at connect time.

For an application that is exactly right — any replica will do. For an audit it is not.

## Why it matters here and nowhere else

Server settings, replication lag and occasionally the schema itself differ between a primary and its
replicas. A report that does not name the server it read is a report about an unknown database, and
two runs of an unchanged project can disagree — a difference that reads as drift.

So SQLens does not choose. Either the configuration leaves exactly one possibility, or you name one,
or the run stops.

## What to do

Name the host:

```bash
php artisan sqlens:audit --host=replica-1.internal
```

…or settle it in config:

```php
// config/sqlens.php
'host' => 'replica-1.internal',
```

A host the connection does not offer is refused rather than dialed — see
[unoffered host](https://docs.pushery.com/sqlens-for-laravel/rules/cap-l0-unoffered-host.md).

## Related

- [Read/write splits and replicas](https://docs.pushery.com/sqlens-for-laravel/read-write-split.md) — both `read` shapes the framework accepts, and what each one means for an audit
