---
title: "U3002: Operation not permitted by capability type"
url: https://una-lang.org/en/docs/errors/U3002/
release: v0.4.0
source: https://github.com/una-lang/una/blob/v0.4.0/crates/una-explain/explain/U3002.md
---

# U3002: Operation not permitted by capability type

The code uses an operation that the capability type of the binding in scope does not permit.

## Why Una rejects it

A binding `@x: C[ops]` permits only the operations listed in brackets; without brackets it permits all of them (`spec/05 §3`). U3002 reports:

- an operation that the binding in scope does not permit;
- a call whose callee needs more operations of `@x` than the caller holds, since passing a capability attenuates it but never widens it (`spec/05 §4`).

## How to fix it

- When another binding in scope permits the operation, use it, or rebind the callee's reference to it with `with`. The code keeps its authority.
- Adding the operation to the `uses` clause, or dropping the brackets to permit every operation, widens the header: every caller must then permit it too. That repair is marked as a widening in `--json` and ranks after the ones that keep authority (ADR 0097).

## The repair at a glance

```diff
  module demo

  capability Log
    op write(line: Text) -> Unit
    op flush() -> Unit

  pub finish() -> Unit
-   uses @log: Log[write]
+   uses @log: Log[write, flush]
  =
    @log.flush()
```

## Failing example

```una
module demo

capability Log
  op write(line: Text) -> Unit
  op flush() -> Unit

pub finish() -> Unit
  uses @log: Log[write]
=
  @log.flush()
```

## Fixed example

```una
module demo

capability Log
  op write(line: Text) -> Unit
  op flush() -> Unit

pub finish() -> Unit
  uses @log: Log[write, flush]
=
  @log.flush()
```
