# `documents.settings_invalid`

An application's `documents:` holds something it doesn't take, a `layout:` that isn't a document layout, or a `connection:` whose package doesn't provide `documents`.

Area 16, [Built-in services](/docs/built-in-services.md); not declinable; the next step is usually the agent's.

## Why Jadpo refuses it

`documents:` names the layout every document is wrapped in, a `.html`
file in `shared/documents/`. A layout that isn't there would leave every
document unwrapped without a word, and a setting `documents:` doesn't
take, a misspelt `layout:` among them, would be dropped the same way, so
Jadpo refuses both where they are written.

`connection:` names the connection that turns each document's HTML into
a PDF, a package that maps the `documents` capability in
`provides/documents.jadpo`. One whose package has no such mapping, or a
name that is no package's connection, could make no PDF, and neither can
a `documents.pdf` call in an app whose `documents:` names no connection,
so each is refused too.

## What it looks like

`app.jadpo` names a layout nobody has written yet:

```jadpo
application {
    display_name: "Acme"
    documents: {
        layout: "shared/documents/letterhead.html"
    }
}
```

```text
error: `layout:` names `shared/documents/letterhead.html`, which doesn't exist
 --> app.jadpo:4:17
  |
4 |         layout: "shared/documents/letterhead.html"
  |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no such file
  reason: `layout:` names the file every document is wrapped in, so it must exist.
  next: Create `shared/documents/letterhead.html`, reading `{{ content }}` where each document goes, or name a layout that is there (agent)
  rule: documents.settings_invalid
  help: https://jadpo.dev/docs/errors/documents.settings_invalid

check failed: 1 error, 1 file
```

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

## How to fix it

**If the layout is new**, write it, reading `{{ content }}` where each
document goes. In `shared/documents/letterhead.html`:

```jadpo
<!doctype html>
<html dir="{{ locale.direction }}">
<body>
<header>Acme</header>
{{ content }}
</body>
</html>
```


Every document is now wrapped in the letterhead.

**If the app has one layout already**, keep it in
`shared/documents/layout.html` and leave `documents:` out, since that
file is the layout when nothing else is named:

```jadpo
application {
    display_name: "Acme"
}
```


Every document is wrapped in `shared/documents/layout.html`.

## Related

- [Documents](/docs/documents.md)
- [What `application { }` holds](/docs/application-sections.md)
