# `package.reads_app`

A package's code reaches out of the package, to `shared/`, a domain, a root file or another package the app installs.

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

## Why Jadpo refuses it

A package is code many apps install, so it has to mean the same in each
of them. Code that read the app's `shared/` folder, a domain or another
installed package would compile against whatever that app happens to
hold, and the verifier, which checks a package with no app at all, would
be checking something no app runs. The app's own integration in
`shared/providers/` is held to the same rule, so it can be published
unchanged.

## What it looks like

`Booking`, in the app's own integration, uses a type from the app's
`shared/types/`:




`shared/providers/acme_couriers/v1/types/booking.jadpo`:

```jadpo
use shared/types { ParcelLabel }

/// What booking a collection takes.
public type Booking = Object {
    label: ParcelLabel
}
```

```text
error: `use shared/types` reads the app, outside package `AcmeCouriers`
 --> shared/providers/acme_couriers/v1/types/booking.jadpo:1:5
  |
1 | use shared/types { ParcelLabel }
  |     ^^^^^^^^^^^^ outside the package
  reason: A package reads only its own code, which it writes bare with no `use` line, so it means the same in every app that installs it, and the verifier, which checks it with no app, checks what each app runs. `shared/types` belongs to the app, not to `shared/providers/acme_couriers/v1`.
  next: Remove the line, and declare what the package needs in its own folders; a value of the app's comes in as an argument of one of the package's types (agent)
  rule: package.reads_app
  help: https://jadpo.dev/docs/errors/package.reads_app

check failed: 1 error, 4 files
```

`(agent)` at the end of the `next:` line means your coding agent can make
the fix itself.

The line is the one report: `ParcelLabel`, which it brought in, isn't reported
again. A `use` line naming a domain, a root file or another package is
refused the same way, and so is a name only the app declares, written with
no `use` line, or one written through another installed package: packages
have no dependencies, so one can't count on another being there.

## How to fix it

**If the package needs a type like the app's**, declare its own in its
folders, where its code names it bare, with no `use` line:

```jadpo
/// The words Acme prints on a parcel's label.
public type Label = Text {
    max_length: 40
}
```

```jadpo
/// What booking a collection takes.
public type Booking = Object {
    label: Label
}
```



The app's own value reaches the package as an argument of the package's
type, `AcmeCouriers.Label`, which the app builds from its `ParcelLabel` where
it calls the package.

## Related

- [What package code may do](/docs/what-package-code-may-do.md)
- [What is public](/docs/the-package-format.md#what-is-public)
