# `import.missing`

A file uses a name declared elsewhere in the project without bringing it in on a `use` line.

Area 1, [Project layout and modules](/docs/project-layout-and-modules.md); not declinable; the next step is usually the agent's.

## Why Jadpo refuses it

Each file says where its other names come from, on `use` lines at its
top, so you or an agent can read where a name lives from the file
itself, without searching the project. A name the file uses but doesn't
import leaves that question open.

The fix is never in doubt. Every name a file can import is unique where
it can be imported, so only one `use` line brings it in.

## What it looks like

domains/bakery/actions/stock_loaf.jadpo:



```jadpo
action stock_loaf(each: Stock) -> Stock {
    return each
}
```

```text
error: `Stock` isn't imported
 --> domains/bakery/actions/stock_loaf.jadpo:1:25
  |
1 | action stock_loaf(each: Stock) -> Stock {
  |                         ^^^^^ not imported
  reason: Every name a file uses that it doesn't declare comes in on a `use` line, so a reader sees where it lives; `Stock` is a type in `shared/types/stock.jadpo`.
  next: Add `use shared/types { Stock }`, or run `jadpo fmt`, which adds every missing import (agent)
  rule: import.missing
  help: https://jadpo.dev/docs/errors/import.missing

check failed: 1 error, 3 files
```

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

## How to fix it

**If one name is missing**, add its `use` line at the top of the file.
In `domains/bakery/actions/stock_loaf.jadpo`:

```jadpo
use shared/types { Stock }
```




The file now says that `Stock` is in `shared/types/stock.jadpo`, and the
project checks.

**If several names are missing**, let the formatter write the lines:

```sh
jadpo fmt
```

`jadpo fmt` adds every missing import and removes every unused one, one
line per folder, sorted. It does this once every file in the project
parses.

## Related

- [Imports](/docs/imports.md)
- [What is imported](/docs/imports.md#what-is-imported)
- [The formatter keeps imports](/docs/imports.md#the-formatter-keeps-imports)
- [Where the lines go](/docs/imports.md#where-the-lines-go)
