---
title: "U3020: Call into a boundary module whose capability is not granted with `with`"
url: https://una-lang.org/en/docs/errors/U3020/
release: v0.4.0
source: https://github.com/una-lang/una/blob/v0.4.0/crates/una-explain/explain/U3020.md
---

# U3020: Call into a boundary module whose capability is not granted with `with`

A call into a boundary module needs a capability that the call does not grant with `with`.

## Why Una rejects it

From edition `0.3`, `una.toml` can declare modules of the package as boundaries under `[boundaries]`, and from edition `0.4` the `boundaries` section of `ita.una` does (ADR 0093): code the package's author does not control, such as a vendored library or a plug-in. No authority crosses a boundary by name.

A call into a boundary module, from any module outside its extent, does not meet the callee's `uses` from the caller's bindings by name. Every capability the callee needs is granted at the call with `with`, as a rebinding, a narrowed rebinding (`@y[ops]`) or a handler.

The same holds for:

- a function of a boundary used as a value outside it, at the reference;
- a handler of a boundary installed outside it, whose `uses` are granted by another binding of the same `with`.

An example's `do` line takes no `with`, so an example outside a boundary can call only boundary functions that need no capability.

## How to fix it

The repair is a grant at the call, within the boundary's ceiling (U3021), narrowed to what the callee declares.

- When the ceiling allows every operation the callee needs and the caller holds a binding that permits them, the first repair is `with @x = @y[ops]`. `una fix` applies it at a call that is its statement's whole expression, when `@y` is `@x` itself or the only binding that qualifies.
- When several bindings qualify, the repair lists them and carries no edit: which resource the boundary receives is the consumer's decision.
- When the ceiling withholds an operation, no grant is offered. The repair is a handler whose own `uses` lie within the ceiling, and it names what the ceiling withholds.

Widening the caller's header or the ceiling is never the repair: the grant is what the consumer reviews, and the ceiling is the consumer's decision.

## The repair at a glance

`src/demo/app.una`

```diff
  module demo.app

  import demo.store (Files)
  import demo.vendor (load)

  pub open(path: Text) -> Text
    uses @files: Files[read, write]
  =
-   load(path)
+   load(path) with @files = @files[read]
```

## Failing example

`una.toml`

```toml
[package]
name = "demo"
version = "0.1.0"
edition = "0.3"

[boundaries]
"demo.vendor" = ["Files[read]"]
```

`src/demo/store.una`

```una
module demo.store

pub capability Files
  op read(path: Text) -> Text
  op write(path: Text, data: Text) -> Unit
```

`src/demo/vendor.una`

```una
module demo.vendor

import demo.store (Files)

pub load(path: Text) -> Text
  uses @files: Files[read]
=
  @files.read(path)
```

`src/demo/app.una`

```una
module demo.app

import demo.store (Files)
import demo.vendor (load)

pub open(path: Text) -> Text
  uses @files: Files[read, write]
=
  load(path)
```

## Fixed example

`una.toml`

```toml
[package]
name = "demo"
version = "0.1.0"
edition = "0.3"

[boundaries]
"demo.vendor" = ["Files[read]"]
```

`src/demo/store.una`

```una
module demo.store

pub capability Files
  op read(path: Text) -> Text
  op write(path: Text, data: Text) -> Unit
```

`src/demo/vendor.una`

```una
module demo.vendor

import demo.store (Files)

pub load(path: Text) -> Text
  uses @files: Files[read]
=
  @files.read(path)
```

`src/demo/app.una`

```una
module demo.app

import demo.store (Files)
import demo.vendor (load)

pub open(path: Text) -> Text
  uses @files: Files[read, write]
=
  load(path) with @files = @files[read]
```
