# `route.calls_past_deadline`

Outside calls a route reaches can take longer than its deadline.

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

> The choices are in area 12's decisions, "The late-failure warning and
> the deadline sum".

Each outside call can wait its `timeout:` on each of its attempts: a
provider's operation its connection's `timeout:` (3 seconds by default)
times its `retry: { attempts: }` (3), an `ai` call its own `timeout:`
times its `attempts:` (area 21). A route's deadline covers every such
call on the longest way through its action, those of the actions and
package actions it calls included, so the sum must fit within it. Here
the courier's lookup can wait 5 seconds three times, past the route's 10:













```jadpo
use app { couriers }
use shipping/types { ParcelAnswer, ParcelQuestion }
use shared/providers/acme_couriers

/// Where a parcel is, in the courier's words.
action parcel_status(enquiry: ParcelQuestion) -> ParcelAnswer {
    var parcel_found: AcmeCouriers.Parcel = couriers.parcels.get(
        AcmeCouriers.ParcelLookup {
            id: enquiry.parcel
        }
    )
    return ParcelAnswer {
        status: parcel_found.status
    }
}
```

```jadpo
use shipping/types { ParcelAnswer, ParcelQuestion }
use shipping/actions { parcel_status }

/// Where customers ask after their parcels.
routes Parcels {
    prefix: /parcels

    /// Where a parcel is.
    POST /status {
        authentication: RouteAuthentication.none
        input: ParcelQuestion
        output: ParcelAnswer
        status: SuccessStatus.ok
        run: parcel_status(input)
    }
}
```

```text
error: `POST /parcels/status` runs `parcel_status`, whose outside calls can take 15s, longer than its 10s deadline
 --> domains/shipping/routes/parcels.jadpo:9:5
  |
9 |     POST /status {
  |     ^^^^^^^^^^^^ deadline 10s
  reason: Each outside call can wait its `timeout:` on each of its attempts, and a route's deadline covers every call on the longest way through `parcel_status`, those of the actions it calls included; at the deadline the route stops, so a call still waiting, or still to be tried again, never finishes.
  next: Give the route `deadline: 15s`, lower the `timeout:` or the attempts of the calls (a connection's `timeout:` and `retry: { attempts: }`, an `ai` call's `timeout:` and `attempts:`), or answer `202` and make the calls in a subscriber (agent)
  rule: route.calls_past_deadline
  help: https://jadpo.dev/docs/errors/route.calls_past_deadline

check failed: 1 error, 13 files
```

A route that needs longer than 60 seconds can't be given it: it answers
`202` and makes its calls in a subscriber, which the route waits for with
`settle:` (area 7).
