# `connection.domain_not_listed`

An action calls an outside service through a connection whose `domains:` list doesn't include the action's domain.

Area 11, [External services](/docs/external-services.md); not declinable; the next step is usually the human's.

## Why Jadpo refuses it

Each connection in `app.jadpo` lists the domains whose actions may call
it, such as `domains: [shipping]` for a courier's API. A new caller then
shows in review as a one-line change to that list. Other domains reach
the service through the listed domain's public actions, so the code that
talks to it stays in one place.

Jadpo won't add the domain for you. The list decides which parts of your
app may use an outside service, and so what a change to one domain can
reach.

## What it looks like







app.jadpo:

```jadpo
application {
    connections: {
        couriers: {
            package: AcmeCouriers.v1
            domains: [shipping]
            environment: config.couriers_environment
        }
    }
}
```


The `support` domain calls the connection directly.

domains/support/actions/track_parcel.jadpo:

```jadpo
use app { couriers }
use shared/providers/acme_couriers

/// Where a customer's parcel is.
action track_parcel(lookup: AcmeCouriers.ParcelLookup) -> AcmeCouriers.Parcel {
    return couriers.parcels.get(lookup)
}
```

```text
error: `support` calls `couriers`, whose `domains:` doesn't list it
 --> domains/support/actions/track_parcel.jadpo:6:12
  |
6 |     return couriers.parcels.get(lookup)
  |            ^^^^^^^^^^^^^^^^^^^^ not a listed domain
  reason: A connection lists the domains whose actions may call it, so a new caller is a one-line change a reviewer sees; `couriers` lists `shipping`, and other domains go through their public actions.
  next: Add `support` to `couriers`'s `domains:` in `app.jadpo`, or call one of `shipping`'s public actions instead (human)
  rule: connection.domain_not_listed
  help: https://jadpo.dev/docs/errors/connection.domain_not_listed

check failed: 1 error, 9 files
```

`(human)` at the end of the `next:` line tells your coding agent to stop
and ask you which fix you want, because the choice is yours to make: it
decides which domains may call the courier's API.

## How to fix it

The question is whether `support` should talk to the courier itself.

**If it should**, add `support` to the connection's `domains:` in
`app.jadpo`:

```jadpo
            domains: [shipping, support]
```











`support`'s actions may now call `couriers` directly, and the change shows
in review as a new caller.

**If it should go through `shipping`**, give `shipping` a public action
that makes the call. `domains/shipping/actions/locate_parcel.jadpo`:

```jadpo
use app { couriers }
use shared/providers/acme_couriers

/// Where a customer's parcel is, for other domains to ask.
public action locate_parcel(lookup: AcmeCouriers.ParcelLookup) -> AcmeCouriers.Parcel {
    return couriers.parcels.get(lookup)
}
```

Then `support` calls that action, with `use shipping` in place of
`use app { couriers }`. In `domains/support/actions/track_parcel.jadpo`:

```jadpo
use shipping
    return shipping.locate_parcel(lookup)
```











Only `shipping` calls the courier, and `support` asks `shipping` where a
parcel is.

## Related

- [Connecting in `app.jadpo`](/docs/connecting-in-app-jadpo.md)
- [Calling a provider](/docs/calling.md#calling-a-provider)
- [Changing another domain's data](/docs/ownership-and-calls-replace-modules.md#changing-another-domains-data)
